mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 07:21:39 +00:00
Compare commits
506 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f535c33ae | ||
|
|
20dd9fc8ca | ||
|
|
6110526402 | ||
|
|
0a1f44ac4d | ||
|
|
d048f23ff8 | ||
|
|
f5f8255a37 | ||
|
|
cc4d91fcb3 | ||
|
|
89c76a682e | ||
|
|
63577b9986 | ||
|
|
713e97f6c3 | ||
|
|
c392da09a6 | ||
|
|
02d4841d05 | ||
|
|
cbe9ed4980 | ||
|
|
d654e5e84f | ||
|
|
9d2bd82173 | ||
|
|
02affa5677 | ||
|
|
71a023ebae | ||
|
|
aa75b52255 | ||
|
|
6cf7cdc2a6 | ||
|
|
5b804f5a35 | ||
|
|
b348920d25 | ||
|
|
b6fe9b06cc | ||
|
|
fde2041f17 | ||
|
|
7a4b0e64ad | ||
|
|
afe9c4b5f4 | ||
|
|
5e6694cb8b | ||
|
|
d20f6bb653 | ||
|
|
e8032f37fc | ||
|
|
cae159e77c | ||
|
|
47812f5822 | ||
|
|
afa9903882 | ||
|
|
a7d465bfa1 | ||
|
|
95dfd59e4e | ||
|
|
08e6278a77 | ||
|
|
fbf47a2825 | ||
|
|
643e84c49a | ||
|
|
25c7e8909e | ||
|
|
0d5972c66b | ||
|
|
394d7f23bf | ||
|
|
09d9c6597f | ||
|
|
1d8c8ee264 | ||
|
|
5a9d6d6d14 | ||
|
|
4d13ee8100 | ||
|
|
6b0ae0602c | ||
|
|
d0bd2f7b20 | ||
|
|
5f965cf174 | ||
|
|
504a10ce5e | ||
|
|
a9abd1c2ea | ||
|
|
e7e859adce | ||
|
|
0c98a65e79 | ||
|
|
cd30d7a4a5 | ||
|
|
a6d837e64a | ||
|
|
0904b0ba56 | ||
|
|
150c81e397 | ||
|
|
1717f35717 | ||
|
|
61b6b346da | ||
|
|
b02fb57d8f | ||
|
|
cb302e6719 | ||
|
|
1f9030c504 | ||
|
|
af5a4af675 | ||
|
|
664321465c | ||
|
|
f6d4b5e82a | ||
|
|
09c9f704e5 | ||
|
|
8a8b780273 | ||
|
|
1f0de4923e | ||
|
|
d5833e3e4b | ||
|
|
deffcdcd84 | ||
|
|
ba2eeeeac7 | ||
|
|
36b94b37d0 | ||
|
|
85b93260e2 | ||
|
|
94f74a485b | ||
|
|
b4253525fe | ||
|
|
c38c91217c | ||
|
|
f024af4912 | ||
|
|
6976ffe079 | ||
|
|
2812c3863d | ||
|
|
9ad7927c4c | ||
|
|
afae462b6e | ||
|
|
62e733c018 | ||
|
|
d446a56381 | ||
|
|
2bdf47a572 | ||
|
|
caf99c6cf8 | ||
|
|
5415659fb9 | ||
|
|
e967ba15cf | ||
|
|
0b191fbd17 | ||
|
|
2ea58acc70 | ||
|
|
1f59a81c28 | ||
|
|
fbcb18c978 | ||
|
|
dd7bb313f4 | ||
|
|
946ed2e339 | ||
|
|
96da5bd9c5 | ||
|
|
9f77d5f550 | ||
|
|
9e6cf1f1aa | ||
|
|
d92fa0dee1 | ||
|
|
63109f5717 | ||
|
|
dc33ea57ef | ||
|
|
780bd9c0f9 | ||
|
|
a79041d211 | ||
|
|
eda8e293c3 | ||
|
|
fd797b1a69 | ||
|
|
fd098fc3f7 | ||
|
|
1be2ccdb0b | ||
|
|
cb46174bae | ||
|
|
ac1578793f | ||
|
|
525922ee69 | ||
|
|
5327979745 | ||
|
|
3a0e404832 | ||
|
|
55b1f1e08e | ||
|
|
a05383c635 | ||
|
|
86abc0001c | ||
|
|
c4ff2e736a | ||
|
|
d00d5f2996 | ||
|
|
5f0f6e5b61 | ||
|
|
f39573007c | ||
|
|
f7a367e895 | ||
|
|
dcba92190f | ||
|
|
614d57f130 | ||
|
|
9e170c4ae4 | ||
|
|
85070a5c9c | ||
|
|
f86fc35fa7 | ||
|
|
53184b8df0 | ||
|
|
f385d5c47d | ||
|
|
1527e12013 | ||
|
|
58800f69b1 | ||
|
|
049da42d4a | ||
|
|
21f2e8a9f7 | ||
|
|
432b777f2c | ||
|
|
e39c9d920d | ||
|
|
b84c2b0884 | ||
|
|
e4d0118e9d | ||
|
|
0bf98c46cb | ||
|
|
442b08fdb9 | ||
|
|
9c2a9d76d2 | ||
|
|
a354741c31 | ||
|
|
8d62307987 | ||
|
|
e2de979081 | ||
|
|
0f62bcd41f | ||
|
|
d4c9644368 | ||
|
|
0c4fe26c21 | ||
|
|
3cf8607b20 | ||
|
|
3d2d838bd1 | ||
|
|
a9204cb399 | ||
|
|
bd3b102c2f | ||
|
|
9cf27a35dd | ||
|
|
c1c5b15859 | ||
|
|
3e55de545f | ||
|
|
ced6729157 | ||
|
|
a57eb17640 | ||
|
|
6c2863d709 | ||
|
|
fc05b244a8 | ||
|
|
c80fd77416 | ||
|
|
e2d15db3f4 | ||
|
|
8057a5cf19 | ||
|
|
a6ab849df2 | ||
|
|
7143d3b8ac | ||
|
|
be6d90ace2 | ||
|
|
7023905b53 | ||
|
|
f4817ee4eb | ||
|
|
a87eee0849 | ||
|
|
a8803fd166 | ||
|
|
18f68d96b7 | ||
|
|
ecd61e3777 | ||
|
|
10eeac9ae7 | ||
|
|
59e6a3d262 | ||
|
|
292fe2136c | ||
|
|
f80cd9edd1 | ||
|
|
adbfae2b71 | ||
|
|
4cfda07b2a | ||
|
|
3ac7802315 | ||
|
|
1813e5a09c | ||
|
|
c9184acee1 | ||
|
|
1c98d6b18c | ||
|
|
7172671dcc | ||
|
|
294e269ede | ||
|
|
00c98501ff | ||
|
|
51d5be4e9d | ||
|
|
f86c0e33c4 | ||
|
|
3888d8ee8b | ||
|
|
8029796193 | ||
|
|
f3c28f57ac | ||
|
|
03db0d357a | ||
|
|
7ad6095e16 | ||
|
|
617bc70944 | ||
|
|
f2d2d56111 | ||
|
|
84d31f9449 | ||
|
|
da3745f386 | ||
|
|
7e47100d3e | ||
|
|
0c8e8fb4f7 | ||
|
|
f337206785 | ||
|
|
3984bc92f2 | ||
|
|
89fe60a213 | ||
|
|
3ebec419fe | ||
|
|
fed2459677 | ||
|
|
33c7049d71 | ||
|
|
e44f51d647 | ||
|
|
31aa2f09c5 | ||
|
|
3fffc01890 | ||
|
|
e1abf80569 | ||
|
|
a7fde9b6cc | ||
|
|
92d3ed48db | ||
|
|
c5455de9d1 | ||
|
|
7b5b054818 | ||
|
|
17a609cd9c | ||
|
|
ae128f6e91 | ||
|
|
cb24ca9ee5 | ||
|
|
e37b9f7d81 | ||
|
|
55600edb2d | ||
|
|
033068b5d7 | ||
|
|
9ea7db9160 | ||
|
|
1801bf86b6 | ||
|
|
ba5c59bc34 | ||
|
|
bf30a304d8 | ||
|
|
310d530308 | ||
|
|
75775d6ea1 | ||
|
|
f9e02b60fa | ||
|
|
c5a3385156 | ||
|
|
403a137847 | ||
|
|
c7bd1afc39 | ||
|
|
fcf24d32c9 | ||
|
|
53bcbefb63 | ||
|
|
e010ebd09e | ||
|
|
663ca6981e | ||
|
|
e41c4d806f | ||
|
|
6ad5ae6a67 | ||
|
|
0da348045f | ||
|
|
64629cfb4d | ||
|
|
4a589d52d5 | ||
|
|
8f30e6769b | ||
|
|
6016f8d175 | ||
|
|
7b950ffa6e | ||
|
|
f037edad14 | ||
|
|
9c404cddea | ||
|
|
3900cadbd9 | ||
|
|
8b04584ca9 | ||
|
|
c5e560d1cf | ||
|
|
bae969c601 | ||
|
|
0fcdf4ee2c | ||
|
|
4a744d1c1b | ||
|
|
c9daccda3a | ||
|
|
72aad1d90e | ||
|
|
cb9896ed7f | ||
|
|
f81f14364a | ||
|
|
8a77bfab55 | ||
|
|
04cd077426 | ||
|
|
e84979d04a | ||
|
|
f9cdb6168d | ||
|
|
bc1eab1b3d | ||
|
|
aba394f742 | ||
|
|
6a49b833ca | ||
|
|
2c9a07b64a | ||
|
|
7e022be24a | ||
|
|
8bf9cecd10 | ||
|
|
fb860c70e3 | ||
|
|
eb639de347 | ||
|
|
5bd3a83cb2 | ||
|
|
382d99986b | ||
|
|
154b865d7b | ||
|
|
d001a2f34a | ||
|
|
4cfdbe2220 | ||
|
|
0266ffdb97 | ||
|
|
1f7ae5ef3a | ||
|
|
aeda614c5c | ||
|
|
181d8c6585 | ||
|
|
195ae2726d | ||
|
|
484a2eb4ec | ||
|
|
6630313ece | ||
|
|
c7a8caacef | ||
|
|
021b96eaa0 | ||
|
|
fb53ba2b1a | ||
|
|
bf2fcb7aa1 | ||
|
|
518ea8d33f | ||
|
|
3ad570e62e | ||
|
|
5cfb0bfc85 | ||
|
|
59fb9c71e2 | ||
|
|
8e2c957833 | ||
|
|
944921f2e9 | ||
|
|
59f5d68df5 | ||
|
|
91c879d922 | ||
|
|
f918e2b774 | ||
|
|
6cac4b7e1e | ||
|
|
8117cfb10b | ||
|
|
4b926da0d6 | ||
|
|
77d4ea7513 | ||
|
|
3160245145 | ||
|
|
6e19f3554a | ||
|
|
ae6eb8fa7d | ||
|
|
5d28b98a8c | ||
|
|
52acfe4ea2 | ||
|
|
01a4f64a2e | ||
|
|
b47a384621 | ||
|
|
e842768bb1 | ||
|
|
998a24d62f | ||
|
|
64d072d8bb | ||
|
|
6835dd9819 | ||
|
|
5f735b11c9 | ||
|
|
4fad0ae2bc | ||
|
|
45da5db11b | ||
|
|
0b9baf8588 | ||
|
|
cef628f314 | ||
|
|
421c2f69f7 | ||
|
|
69cd3ab5f9 | ||
|
|
b144dbef8c | ||
|
|
eff9942466 | ||
|
|
525a5969bc | ||
|
|
b49366fd31 | ||
|
|
354277ba6e | ||
|
|
658391fe85 | ||
|
|
b574bb3f4c | ||
|
|
7b760c645f | ||
|
|
32445dcf55 | ||
|
|
e45fd1aa12 | ||
|
|
3855b3a710 | ||
|
|
1ca812abbf | ||
|
|
7470911bd7 | ||
|
|
adf72acf63 | ||
|
|
0e9f8f5e7e | ||
|
|
eb05d237af | ||
|
|
fa8b4ecef4 | ||
|
|
707b3efea4 | ||
|
|
5f37fadd24 | ||
|
|
eefbece0e1 | ||
|
|
a54102a660 | ||
|
|
b5de592eee | ||
|
|
20493377af | ||
|
|
f91a16268f | ||
|
|
34b3e77d47 | ||
|
|
557009c11e | ||
|
|
32bf174b5c | ||
|
|
6a6d3d4805 | ||
|
|
91b4974d2c | ||
|
|
e50ddf9cb9 | ||
|
|
fdbf364087 | ||
|
|
0eb3354344 | ||
|
|
a798714f21 | ||
|
|
574830796f | ||
|
|
fb26c4ab60 | ||
|
|
614de27310 | ||
|
|
3b6981918a | ||
|
|
84f531ca34 | ||
|
|
11b397a348 | ||
|
|
9fe8c98a42 | ||
|
|
852ce08bf3 | ||
|
|
a18e4c69ee | ||
|
|
43da706a61 | ||
|
|
81691afb46 | ||
|
|
9258229fdb | ||
|
|
e481a71b5c | ||
|
|
fc092ae0b3 | ||
|
|
6c70f9c777 | ||
|
|
15a8225ec1 | ||
|
|
7bb35c0b38 | ||
|
|
cc8c3ddc95 | ||
|
|
10781a7a8e | ||
|
|
2f26e3a1dc | ||
|
|
94eed51465 | ||
|
|
786c344cc8 | ||
|
|
6042e71a0e | ||
|
|
199180406d | ||
|
|
81c916734b | ||
|
|
23c54c68b8 | ||
|
|
2aa4bb9c9a | ||
|
|
2a1cb06201 | ||
|
|
8f300b8d85 | ||
|
|
e51f3e06d4 | ||
|
|
109b91863b | ||
|
|
7b35193639 | ||
|
|
531b2fe018 | ||
|
|
2ebfca2f07 | ||
|
|
1746fb452a | ||
|
|
9d85f8a29a | ||
|
|
4d2260bca9 | ||
|
|
ccd36c8844 | ||
|
|
a66537a2ff | ||
|
|
981104a91e | ||
|
|
21be3f8ca6 | ||
|
|
b0b98b8683 | ||
|
|
eda82afb8b | ||
|
|
937405432f | ||
|
|
d2814b4829 | ||
|
|
6d5f70c13a | ||
|
|
68c1c92a1e | ||
|
|
51197993b6 | ||
|
|
224f996d06 | ||
|
|
902c065e0b | ||
|
|
df9fe07d26 | ||
|
|
e7a3ad1cdd | ||
|
|
5f3066ae4b | ||
|
|
b6a36d27f3 | ||
|
|
945dde6dba | ||
|
|
ff10b07044 | ||
|
|
deaf3a2dcb | ||
|
|
7e1cd077c5 | ||
|
|
5b7b4c73f4 | ||
|
|
2264d9aded | ||
|
|
6f479eafdd | ||
|
|
aafb62ee02 | ||
|
|
fa4698e28e | ||
|
|
400bfb512a | ||
|
|
1d9dd18522 | ||
|
|
c262b7caf6 | ||
|
|
75ff071142 | ||
|
|
8c12c3b4b8 | ||
|
|
bd3bd4a96c | ||
|
|
b20b3cbc6f | ||
|
|
9bfb941b56 | ||
|
|
3ac76188e4 | ||
|
|
e8a72e67e4 | ||
|
|
281bac103c | ||
|
|
559e919636 | ||
|
|
5c7f9fa5a7 | ||
|
|
35fef2f525 | ||
|
|
cfa4bffcc5 | ||
|
|
8235a0308b | ||
|
|
9b834871ea | ||
|
|
23c46abd53 | ||
|
|
03216d27c8 | ||
|
|
2b29461a68 | ||
|
|
3029e3c65a | ||
|
|
a763e00507 | ||
|
|
649d99e09f | ||
|
|
581e183246 | ||
|
|
7e5d6a1f07 | ||
|
|
d84f5adcad | ||
|
|
294bc5d053 | ||
|
|
f67c876c0d | ||
|
|
375028dbf2 | ||
|
|
97c6ae4481 | ||
|
|
325748d945 | ||
|
|
e8d017398c | ||
|
|
0c06d41c9d | ||
|
|
7fb15113fa | ||
|
|
d489788248 | ||
|
|
ebf5dad9bb | ||
|
|
7bc156f01e | ||
|
|
2c0902f248 | ||
|
|
edaf60fea9 | ||
|
|
5c47ccd78e | ||
|
|
6bb6286761 | ||
|
|
9ca38166dd | ||
|
|
a2a00ad31a | ||
|
|
5fe79633bf | ||
|
|
450368779c | ||
|
|
4feba7504f | ||
|
|
d804d65cde | ||
|
|
3e2d887a12 | ||
|
|
e4549f8701 | ||
|
|
80481a5117 | ||
|
|
86e32f6aed | ||
|
|
7415021ba1 | ||
|
|
cd5ab322cb | ||
|
|
ea1f1b14bd | ||
|
|
b6817403ad | ||
|
|
bc13118eb7 | ||
|
|
b1502a6028 | ||
|
|
9147a12705 | ||
|
|
236cf1853f | ||
|
|
27c083985c | ||
|
|
4c92b9418e | ||
|
|
7fdd07cfa5 | ||
|
|
11253f5009 | ||
|
|
1279602f1c | ||
|
|
ec6b89160d | ||
|
|
0dd55875f7 | ||
|
|
2296d30900 | ||
|
|
75600bc725 | ||
|
|
bc7914e1df | ||
|
|
2003c1e7ff | ||
|
|
cf5fcbdf0b | ||
|
|
fde169636f | ||
|
|
7af4a012b4 | ||
|
|
8cd42f519b | ||
|
|
8fdf428143 | ||
|
|
e089a4730f | ||
|
|
d843678ec4 | ||
|
|
e6825dcc7b | ||
|
|
08fc594349 | ||
|
|
68edfda978 | ||
|
|
68014d8f95 | ||
|
|
aaab2bc6ef | ||
|
|
f0c92bb328 | ||
|
|
327f402c1c | ||
|
|
708e36b7ed | ||
|
|
ff229b522f | ||
|
|
9992996104 | ||
|
|
eebd72c5e4 | ||
|
|
9ae0953b50 | ||
|
|
7357007a50 | ||
|
|
8ae0a43282 | ||
|
|
2f3732ec77 | ||
|
|
dd7ceafc4d | ||
|
|
e2ede3e976 | ||
|
|
f854ae6180 | ||
|
|
122c145b6c | ||
|
|
05c44f66b8 | ||
|
|
ba00ce65a6 | ||
|
|
dc24a2072e | ||
|
|
fbd2fea4f1 | ||
|
|
fad0e6a208 | ||
|
|
18125677b2 | ||
|
|
43e99499a7 | ||
|
|
74468739a6 | ||
|
|
214037f1bb | ||
|
|
3ea0bd9d45 | ||
|
|
ee05a31f64 | ||
|
|
fc3e2fde78 | ||
|
|
ad3f679c5a |
41
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
41
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
## PR Checklist
|
||||
Please check if your PR fulfills the following requirements:
|
||||
|
||||
- [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features)
|
||||
- [ ] Docs have been added / updated (for bug fixes / features)
|
||||
|
||||
|
||||
## PR Type
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
<!-- Please check the one that applies to this PR using "x". -->
|
||||
```
|
||||
[ ] Bugfix
|
||||
[ ] Feature
|
||||
[ ] Code style update (formatting, local variables)
|
||||
[ ] Refactoring (no functional changes, no api changes)
|
||||
[ ] Build related changes
|
||||
[ ] CI related changes
|
||||
[ ] Other... Please describe:
|
||||
```
|
||||
|
||||
## What is the current behavior?
|
||||
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
|
||||
## Does this PR introduce a breaking change?
|
||||
```
|
||||
[ ] Yes
|
||||
[ ] No
|
||||
```
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
|
||||
|
||||
|
||||
## Other information
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,14 +1,16 @@
|
||||
# dependencies
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
# IDE
|
||||
/.idea
|
||||
/.awcache
|
||||
/.vscode
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
lerna-debug.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/src/common/npm-debug.log
|
||||
/src/core/npm-debug.log
|
||||
/src/testing/npm-debug.log
|
||||
@@ -24,3 +26,4 @@ npm-debug.log
|
||||
/test
|
||||
/coverage
|
||||
/.nyc_output
|
||||
build/config\.gypi
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
/bundle
|
||||
23
.travis.yml
23
.travis.yml
@@ -1,14 +1,23 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- "10"
|
||||
cache:
|
||||
directories:
|
||||
- "node_modules"
|
||||
git:
|
||||
depth: 5
|
||||
addons:
|
||||
firefox: "latest"
|
||||
firefox: "latest"
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
before_install:
|
||||
- npm i -g npm@latest
|
||||
install:
|
||||
- npm install
|
||||
- gulp build
|
||||
- npm ci
|
||||
- gulp build
|
||||
script:
|
||||
- npm test
|
||||
- npm test
|
||||
after_success: npm run coverage
|
||||
299
CHANGELOG.md
299
CHANGELOG.md
@@ -1,299 +0,0 @@
|
||||
## 4.5.7
|
||||
- **core**: [bugfix] #337
|
||||
|
||||
## 4.5.6
|
||||
- **core**: [bugfix] dynamic modules `exports`
|
||||
|
||||
## 4.5.5
|
||||
- **core**: [bugfix] add missing `app.engine()` wrapper
|
||||
|
||||
## 4.5.4
|
||||
- **core**: [bugfix] dynamic modules recurrent imports fix
|
||||
|
||||
## 4.5.3
|
||||
- **testing**: [bugfix] issue #326
|
||||
|
||||
## 4.5.2
|
||||
- **common**: [feature] rename `modules` to `imports` (`@Module()` decorator)
|
||||
- **core**: [feature] exception filters with empty `@Catch()` metadata handle each occurred exception
|
||||
- **core**: [improvement] increase performance
|
||||
|
||||
## 4.5.1
|
||||
- **common**: [feature] `INestAplication` provides a `getHttpServer()` method now
|
||||
- **websockets**: [bugfix] `IoAdapter` bugfix
|
||||
|
||||
## 4.5.0
|
||||
- **common**: bugfix #286
|
||||
- **core**: dynamic modules feature
|
||||
- **core**: global scope feature
|
||||
- **core**: `ExternalContextCreator` & `ModulesContainer`
|
||||
- **core**: merge `NestApplicationContext` with `NestApplication`
|
||||
- **core**: `NotFoundException` is thrown when route is not available #298
|
||||
- **core**: add `set()` wrapper around native express methods
|
||||
- **core**: bugfix #281
|
||||
- **websockets**: bugfix #271
|
||||
- **microservices**: log RPC exceptions #303
|
||||
- **microservices**: merge `NestApplicationContext` with `NestMicroservice`
|
||||
- **microservices**: handle ECONNREFUSED #288
|
||||
|
||||
## 4.4.1
|
||||
- **common**: `ValidationPipe` improvement
|
||||
- **common**: custom route params decorators accepts pipes now
|
||||
- **core**: bugfix #268
|
||||
|
||||
## 4.4.0
|
||||
- **core**: possibility to create the `NestApplicationContext` using `NestFactory.createApplicationContext()` (Nest application without HTTP server / microservice in the background)
|
||||
- **core**: create custom params decorators feature (`createRouteParamDecorator()`)
|
||||
|
||||
## 4.3.3
|
||||
- **common**: `ParseIntPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **common**: package contains a set of useful HTTP exceptions now, such as `ForbiddenException`, `UnauthorizedException`, `BadRequestException` etc
|
||||
- **core**: `HttpException` was moved to `@nestjs/common`. This one from `core` packages is now DEPRECATED and will be removed in the next MAJOR release
|
||||
|
||||
## 4.3.0
|
||||
- **common**: `ValidationPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **core**: `json` and `urlencoded` (`body-parser`) middlewares are applied by default now, bugfix #252
|
||||
- **core** more informative error message (injector) #223
|
||||
example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService (+, +, ?, +, +, +). Please verify whether [2] argument is available in the current context.`
|
||||
- **core**: bugfix #240 - middlewares container state
|
||||
- **core**: bugifx #257 - `@Next()` issue
|
||||
- **testing**: testing module is now independent from `@nestjs/microservices`
|
||||
|
||||
## 4.2.2
|
||||
- **websockets**: bugfix #242
|
||||
|
||||
## 4.2.1
|
||||
- **core**: IoAdapter bugfix
|
||||
|
||||
## 4.2.0
|
||||
- **core**: log controller prefix #153
|
||||
- **websockets**: gateway listen the same port as the app #126
|
||||
|
||||
## 4.1.4
|
||||
- **common**: remove deprecated `@ExceptionFilters()` decorator
|
||||
- **core**: update to latest **express* version (4.16.2)
|
||||
- **core**: bugfix #187
|
||||
- **core**: bugfix #185
|
||||
- **all**: packages codependency refactor
|
||||
- **all**: add *lerna* package
|
||||
|
||||
## 4.1.3
|
||||
- **core**: forward reference bugfixes & security updates
|
||||
|
||||
## 4.1.1
|
||||
- **common**: add `forwardRef()` util
|
||||
- **core**: improve injector & dependencies scanner
|
||||
|
||||
## 4.1.0
|
||||
- **common**: add `@Bind()` and `@Dependencies()` decorators to fix route parameters decorators (pure JavaScript compatibility issue)
|
||||
- **core**: improve performance
|
||||
|
||||
## 4.0.1
|
||||
- **core**: add possibility to setup global guards and global interceptors
|
||||
- **common**: `INestApplication` has `useGlobalInterceptors()` and `useGlobalGuards()` now
|
||||
- **microservices**: add possibility to setup global guards, interceptors, filters and pipes
|
||||
- **core**: add timestamp to log output
|
||||
- **core**: improve pipes performance
|
||||
- **core**: add ability to omit param name when passing param-scoped pipe/s
|
||||
- **websockets**: fix disconnect event issue (pass client instead of socket.io instance)
|
||||
|
||||
## 4.0.0
|
||||
**@nestjs/core**
|
||||
- Asynchronous `NestFactory` [read more](http://www.docs.nestjs.com/first-steps)
|
||||
- New response handling approach [read more](http://www.docs.nestjs.com/controllers)
|
||||
- Interceptors feature [read more](http://www.docs.nestjs.com/interceptors)
|
||||
- `@Shared()` deprecated (modules are singletons by default) [read more](http://www.docs.nestjs.com/modules)
|
||||
- `@SingleScope()` decorator [read more](http://www.docs.nestjs.com/modules)
|
||||
- Modules re-exporting [read more](http://www.docs.nestjs.com/modules)
|
||||
- Deffered & functional middlewares [read more](http://www.docs.nestjs.com/middlewares)
|
||||
- Guards feature [read more](http://www.docs.nestjs.com/guards)
|
||||
- Async components [read more](http://www.docs.nestjs.com/advanced/async-components)
|
||||
- Hierarchical injector improvements [read more](http://www.docs.nestjs.com/advanced/hierarchical-injector)
|
||||
- Mixin classes [read more](http://www.docs.nestjs.com/advanced/mixins)
|
||||
- New `INestApplication` API
|
||||
|
||||
**@nestjs/microservices**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/microservices/basics)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
|
||||
|
||||
**@nestjs/websockets**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/websockets/gateways)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
- New `WebSocketAdapter` API
|
||||
|
||||
**@nestjs/testing**
|
||||
- Completely rewritten testing package
|
||||
|
||||
## 3.0.1 (24.06.2017)
|
||||
**@nestjs/core**
|
||||
- Hierarchical injector bugfix,
|
||||
- Middlewares `@UseFilters()` bugfix (#95).
|
||||
|
||||
**@nestjs/microservices**
|
||||
- TCP server / client bugfix (#91)
|
||||
|
||||
## 3.0.0 (03.06.2017)
|
||||
**@nestjs/common - BREAKING CHANGE**
|
||||
- You should now pass objects into `@UseFilters()` decorator instead of metatypes,
|
||||
- Exception Filters can't inject dependencies (they're not coupled with modules),
|
||||
- `@ExceptionFilters()` is deprecated, use `@UseFilters()` instead.
|
||||
- `INestApplication` has new methods - `useGlobalFilters()` and `useGlobalPipes()`,
|
||||
- New lifecycle hook - `OnModuleDestroy` interface.
|
||||
|
||||
**@nestjs/core**
|
||||
- `@Pipe()` feature (async & sync),
|
||||
- Exception Filters can have global, controller and method scope.
|
||||
|
||||
**@nestjs/websockets - BREAKING CHANGE**
|
||||
- Use `useWebSocketAdapter()` instead of `setIoAdapter()`,
|
||||
- You can port any WS library - just implement `WebSocketAdapter` (@nestjs/common).
|
||||
|
||||
**@nestjs/microservices - BREAKING CHANGE**
|
||||
- Now methods have to return `Observable`, and they receive only one argument `data`,
|
||||
- Microservices can return multiple values, but after emitting `Observable` has to be COMPLETED!
|
||||
- You can port any transport strategy instead of built-in Redis/TCP, just implement `CustomTransportStrategy`.
|
||||
|
||||
## 2.1.3 (27.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.1 (24.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**, **@nestjs/microservices**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.0 (22.05.2017)
|
||||
**@nestjs/common**, **@nestjs/core**
|
||||
- `INestApplication` has new methods now - `init()`, `setGlobalPrefix()`, `connectMicroservice()`, `close()`, `startAllMicroservices()`,
|
||||
- `INestMicroservice` has new method - `close()`
|
||||
|
||||
## 2.0.3 (15.05.2017)
|
||||
**@nestjs/common**
|
||||
- `Req()` (`Request()`) and `Res()` (`Response()`) aliases to avoid conflicts with express typings
|
||||
|
||||
## 2.0.0 (14.05.2017)
|
||||
|
||||
- **Hierarchical injector** improvements
|
||||
- `@Shared(token?: string)` decorator for **scoped**, shared Modules
|
||||
- Modules **are not singletons** anymore
|
||||
- Added `iterare` library for applying multiple transformations to a collection
|
||||
- `Logger` service is public,
|
||||
- Nest is now splitted into feature packages:
|
||||
```typescript
|
||||
@nestjs/core
|
||||
@nestjs/common
|
||||
@nestjs/microservices
|
||||
@nestjs/testing
|
||||
@nestjs/websockets
|
||||
```
|
||||
- `rxjs`, `redis` and `reflect-metadata` moved into `peerDependencies`
|
||||
- `@Patch()` support
|
||||
|
||||
## 1.0.0 (Final - 01.05.2017)
|
||||
|
||||
- Added **Gateway Middlewares** support:
|
||||
|
||||
```
|
||||
@WebSocketGateway({
|
||||
port: 2000,
|
||||
middlewares: [ChatMiddleware],
|
||||
})
|
||||
```
|
||||
Gateway Middleware example:
|
||||
```
|
||||
@Middleware()
|
||||
export class ChatMiddleware implements GatewayMiddleware {
|
||||
public resolve(): (socket, next) => void {
|
||||
return (socket, next) => {
|
||||
console.log('Authorization...');
|
||||
next();
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- New Gateway lifecycle interfaces `OnGatewayInit`, `OnGatewayConnection`, `OnGatewayDisconnect`
|
||||
- `@SubscribeMessage()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@SubscribeMessage('event')
|
||||
```
|
||||
|
||||
- `@Controller()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@Controller('users')
|
||||
```
|
||||
|
||||
- `HttpStatus` (`HttpStatus.OK` etc.) enumerator
|
||||
- **Route params decorators** support
|
||||
|
||||
```
|
||||
Request: () => ParameterDecorator
|
||||
Response: () => ParameterDecorator
|
||||
Next: () => ParameterDecorator
|
||||
Query: (property?: string) => ParameterDecorator
|
||||
Body: (property?: string) => ParameterDecorator
|
||||
Param: (property?: string) => ParameterDecorator
|
||||
Session: () => ParameterDecorator
|
||||
Headers: (property?: string) => ParameterDecorator
|
||||
```
|
||||
|
||||
- `MiddlewaresBuilder` -> `MiddlewaresConsumer`
|
||||
- **Exception Filters** support
|
||||
|
||||
```
|
||||
@ExceptionFilters(CustomExceptionFilter, NextExceptionFilter)
|
||||
export class UsersController {}
|
||||
```
|
||||
Exception filter example:
|
||||
|
||||
```
|
||||
export class CustomException {}
|
||||
|
||||
@Catch(CustomException)
|
||||
export class CustomExceptionFilter implements ExceptionFilter {
|
||||
public catch(exception, response) {
|
||||
response.status(500).json({
|
||||
message: 'Custom exception message.',
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
- Module injection support:
|
||||
|
||||
```
|
||||
export class UsersController {
|
||||
constructor(private module: UsersModule) {}
|
||||
}
|
||||
```
|
||||
|
||||
- `ModuleRef` support
|
||||
|
||||
## 1.0.0-RC7 (08.04.2017)
|
||||
|
||||
- MiddlewareBuilder: `use()` deprecated, use `apply()` instead
|
||||
- MiddlewareBuilder: new `apply()` method
|
||||
|
||||
## 1.0.0-RC4 (08.04.2017)
|
||||
|
||||
- Support for `@Post`, `@Get`, `@Delete`, `@Put`, `@All` decorators
|
||||
- Added ability to pass data to middleware metatypes
|
||||
|
||||
## 1.0.0-BETA-1 (23.03.2017)
|
||||
|
||||
- `@Inject` -> `@Dependencies`
|
||||
- `@Inject` decorator for custom constructor parameters
|
||||
- Custom providers support (useClass, useValue, useFactory)
|
||||
|
||||
## 1.0.0-ALPHA-23 (19.03.2017)
|
||||
|
||||
- Microservices support (TCP & Redis transports)
|
||||
- NestRunner -> NestFactory
|
||||
- Simplify application initialization & configuration
|
||||
- Added abillity to pass custom express instance
|
||||
- `@Inject` decorator for ES6+
|
||||
- SocketGateway -> WebSocketGateway
|
||||
- GatewayServer -> WebSocketServer
|
||||
@@ -183,10 +183,10 @@ Footer should contain a [closing reference to an issue](https://help.github.com/
|
||||
Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
|
||||
|
||||
```
|
||||
docs(changelog): update change log to beta.5
|
||||
docs(changelog) update change log to beta.5
|
||||
```
|
||||
```
|
||||
fix(release): need to depend on latest rxjs and zone.js
|
||||
bugfix(core) need to depend on latest rxjs and zone.js
|
||||
|
||||
The version in our package.json gets copied to the one we publish, and users need the latest of these.
|
||||
```
|
||||
@@ -200,8 +200,8 @@ Must be one of the following:
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **docs**: Documentation only changes
|
||||
* **feat**: A new feature
|
||||
* **fix**: A bug fix
|
||||
* **feature**: A new feature
|
||||
* **bugfix**: A bug fix
|
||||
* **perf**: A code change that improves performance
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
@@ -214,7 +214,7 @@ The following is the list of supported scopes:
|
||||
|
||||
* **common**
|
||||
* **core**
|
||||
* **examples**
|
||||
* **sample**
|
||||
* **microservices**
|
||||
* **testing**
|
||||
* **websockets**
|
||||
@@ -223,7 +223,7 @@ There are currently a few exceptions to the "use package name" rule:
|
||||
|
||||
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
* **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
* **examples/#**: for the example apps directory, replacing # with the example app number
|
||||
* **sample/#**: for the example apps directory, replacing # with the example app number
|
||||
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
|
||||
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
|
||||
|
||||
|
||||
78
Readme.md
78
Readme.md
@@ -1,12 +1,12 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="http://kamilmysliwiec.com/public/nest-logo.png#1" alt="Nest Logo" /></a>
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
@@ -14,10 +14,12 @@
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#7" alt="Coverage" /></a>
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
@@ -25,7 +27,8 @@
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
@@ -34,56 +37,39 @@
|
||||
|
||||
## Getting started
|
||||
|
||||
To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
||||
|
||||
## Sponsors
|
||||
## Support
|
||||
|
||||
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://opencollective.com/nest). Thanks! :heart_eyes:
|
||||
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).
|
||||
|
||||
<h4>Sponsors via <a href="https://opencollective.com/nest">OpenCollective</a></h4>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="210" /></a>
|
||||
#### Principal Sponsor
|
||||
|
||||
<h4>Sponsors & <a href="http://ng-atl.org/workshops/level-up-your-node-js-application-with-nest-angular-sugar-on-the-server">ngAtl</a> Conference Partners </h4>
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.png" width="160" /></a>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
|
||||
|
||||
## Backers
|
||||
#### Gold Sponsors
|
||||
|
||||
<a href="https://opencollective.com/nest/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a>
|
||||
<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>
|
||||
|
||||
## People
|
||||
#### Silver Sponsors
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest"><img src="https://opencollective.com/nest/backers.svg?width=890"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
75
bundle/common/Readme.md
Normal file
75
bundle/common/Readme.md
Normal file
@@ -0,0 +1,75 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#7" alt="Coverage" /></a>
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a> and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a> which improve developer productivity and enable the construction of fast, testable, extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers and tools for Node, none of them effectively solve the main problem - the architecture.</p>
|
||||
<p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, loosely coupled and easily maintainable applications.</p>
|
||||
|
||||
## Getting started
|
||||
|
||||
* To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
||||
|
||||
## Support
|
||||
|
||||
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/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
|
||||
|
||||
#### Gold Sponsors
|
||||
|
||||
<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest"><img src="https://opencollective.com/nest/backers.svg?width=890"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
3
bundle/common/cache/cache.constants.d.ts
vendored
Normal file
3
bundle/common/cache/cache.constants.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare const CACHE_MANAGER = "CACHE_MANAGER";
|
||||
export declare const CACHE_MODULE_OPTIONS = "CACHE_MODULE_OPTIONS";
|
||||
export declare const CACHE_KEY_METADATA = "cache_module:cache_key";
|
||||
5
bundle/common/cache/cache.constants.js
vendored
Normal file
5
bundle/common/cache/cache.constants.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CACHE_MANAGER = 'CACHE_MANAGER';
|
||||
exports.CACHE_MODULE_OPTIONS = 'CACHE_MODULE_OPTIONS';
|
||||
exports.CACHE_KEY_METADATA = 'cache_module:cache_key';
|
||||
8
bundle/common/cache/cache.module.d.ts
vendored
Normal file
8
bundle/common/cache/cache.module.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { DynamicModule } from '../interfaces';
|
||||
import { CacheModuleAsyncOptions, CacheModuleOptions } from './interfaces/cache-module.interface';
|
||||
export declare class CacheModule {
|
||||
static register(options?: CacheModuleOptions): DynamicModule;
|
||||
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule;
|
||||
private static createAsyncProviders(options);
|
||||
private static createAsyncOptionsProvider(options);
|
||||
}
|
||||
60
bundle/common/cache/cache.module.js
vendored
Normal file
60
bundle/common/cache/cache.module.js
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decorators_1 = require("../decorators");
|
||||
const cache_constants_1 = require("./cache.constants");
|
||||
const cache_providers_1 = require("./cache.providers");
|
||||
let CacheModule = CacheModule_1 = class CacheModule {
|
||||
static register(options = {}) {
|
||||
return {
|
||||
module: CacheModule_1,
|
||||
providers: [{ provide: cache_constants_1.CACHE_MODULE_OPTIONS, useValue: options }],
|
||||
};
|
||||
}
|
||||
static registerAsync(options) {
|
||||
return {
|
||||
module: CacheModule_1,
|
||||
imports: options.imports,
|
||||
providers: this.createAsyncProviders(options),
|
||||
};
|
||||
}
|
||||
static createAsyncProviders(options) {
|
||||
if (options.useExisting || options.useFactory) {
|
||||
return [this.createAsyncOptionsProvider(options)];
|
||||
}
|
||||
return [
|
||||
this.createAsyncOptionsProvider(options),
|
||||
{
|
||||
provide: options.useClass,
|
||||
useClass: options.useClass,
|
||||
},
|
||||
];
|
||||
}
|
||||
static createAsyncOptionsProvider(options) {
|
||||
if (options.useFactory) {
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
|
||||
useFactory: options.useFactory,
|
||||
inject: options.inject || [],
|
||||
};
|
||||
}
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
|
||||
useFactory: async (optionsFactory) => await optionsFactory.createCacheOptions(),
|
||||
inject: [options.useExisting || options.useClass],
|
||||
};
|
||||
}
|
||||
};
|
||||
CacheModule = CacheModule_1 = __decorate([
|
||||
decorators_1.Module({
|
||||
providers: [cache_providers_1.createCacheManager()],
|
||||
exports: [cache_constants_1.CACHE_MANAGER],
|
||||
})
|
||||
], CacheModule);
|
||||
exports.CacheModule = CacheModule;
|
||||
var CacheModule_1;
|
||||
2
bundle/common/cache/cache.providers.d.ts
vendored
Normal file
2
bundle/common/cache/cache.providers.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Provider } from '../interfaces';
|
||||
export declare function createCacheManager(): Provider;
|
||||
17
bundle/common/cache/cache.providers.js
vendored
Normal file
17
bundle/common/cache/cache.providers.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const load_package_util_1 = require("../utils/load-package.util");
|
||||
const cache_constants_1 = require("./cache.constants");
|
||||
const default_options_1 = require("./default-options");
|
||||
function createCacheManager() {
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MANAGER,
|
||||
useFactory: (options) => {
|
||||
const cacheManager = load_package_util_1.loadPackage('cache-manager', 'CacheModule');
|
||||
const memoryCache = cacheManager.caching(Object.assign({}, default_options_1.defaultCacheOptions, (options || {})));
|
||||
return memoryCache;
|
||||
},
|
||||
inject: [cache_constants_1.CACHE_MODULE_OPTIONS],
|
||||
};
|
||||
}
|
||||
exports.createCacheManager = createCacheManager;
|
||||
1
bundle/common/cache/decorators/cache-key.decorator.d.ts
vendored
Normal file
1
bundle/common/cache/decorators/cache-key.decorator.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const CacheKey: (key: string) => (target: object, key?: any, descriptor?: any) => any;
|
||||
5
bundle/common/cache/decorators/cache-key.decorator.js
vendored
Normal file
5
bundle/common/cache/decorators/cache-key.decorator.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decorators_1 = require("../../decorators");
|
||||
const cache_constants_1 = require("../cache.constants");
|
||||
exports.CacheKey = (key) => decorators_1.ReflectMetadata(cache_constants_1.CACHE_KEY_METADATA, key);
|
||||
1
bundle/common/cache/decorators/index.d.ts
vendored
Normal file
1
bundle/common/cache/decorators/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './cache-key.decorator';
|
||||
@@ -3,5 +3,4 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./client-proxy"));
|
||||
__export(require("./client-proxy-factory"));
|
||||
__export(require("./cache-key.decorator"));
|
||||
5
bundle/common/cache/default-options.d.ts
vendored
Normal file
5
bundle/common/cache/default-options.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare const defaultCacheOptions: {
|
||||
ttl: number;
|
||||
max: number;
|
||||
store: string;
|
||||
};
|
||||
7
bundle/common/cache/default-options.js
vendored
Normal file
7
bundle/common/cache/default-options.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultCacheOptions = {
|
||||
ttl: 5,
|
||||
max: 100,
|
||||
store: 'memory',
|
||||
};
|
||||
5
bundle/common/cache/index.d.ts
vendored
Normal file
5
bundle/common/cache/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { CACHE_MANAGER } from './cache.constants';
|
||||
export * from './cache.module';
|
||||
export * from './decorators';
|
||||
export * from './interceptors';
|
||||
export * from './interfaces';
|
||||
10
bundle/common/cache/index.js
vendored
Normal file
10
bundle/common/cache/index.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var cache_constants_1 = require("./cache.constants");
|
||||
exports.CACHE_MANAGER = cache_constants_1.CACHE_MANAGER;
|
||||
__export(require("./cache.module"));
|
||||
__export(require("./decorators"));
|
||||
__export(require("./interceptors"));
|
||||
11
bundle/common/cache/interceptors/cache.interceptor.d.ts
vendored
Normal file
11
bundle/common/cache/interceptors/cache.interceptor.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExecutionContext, HttpServer, NestInterceptor } from '../../interfaces';
|
||||
export declare class CacheInterceptor implements NestInterceptor {
|
||||
protected readonly httpServer: HttpServer;
|
||||
protected readonly cacheManager: any;
|
||||
protected readonly reflector: any;
|
||||
protected readonly isHttpApp: boolean;
|
||||
constructor(httpServer: HttpServer, cacheManager: any, reflector: any);
|
||||
intercept(context: ExecutionContext, call$: Observable<any>): Promise<Observable<any>>;
|
||||
trackBy(context: ExecutionContext): string | undefined;
|
||||
}
|
||||
68
bundle/common/cache/interceptors/cache.interceptor.js
vendored
Normal file
68
bundle/common/cache/interceptors/cache.interceptor.js
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const decorators_1 = require("../../decorators");
|
||||
const cache_constants_1 = require("../cache.constants");
|
||||
// NOTE (external)
|
||||
// We need to deduplicate them here due to the circular dependency
|
||||
// between core and common packages
|
||||
const HTTP_SERVER_REF = 'HTTP_SERVER_REF';
|
||||
const REFLECTOR = 'Reflector';
|
||||
let CacheInterceptor = class CacheInterceptor {
|
||||
constructor(httpServer, cacheManager, reflector) {
|
||||
this.httpServer = httpServer;
|
||||
this.cacheManager = cacheManager;
|
||||
this.reflector = reflector;
|
||||
this.isHttpApp = httpServer && !!httpServer.getRequestMethod;
|
||||
}
|
||||
async intercept(context, call$) {
|
||||
const key = this.trackBy(context);
|
||||
if (!key) {
|
||||
return call$;
|
||||
}
|
||||
try {
|
||||
const value = await this.cacheManager.get(key);
|
||||
if (value) {
|
||||
return rxjs_1.of(value);
|
||||
}
|
||||
return call$.pipe(operators_1.tap(response => this.cacheManager.set(key, response)));
|
||||
}
|
||||
catch (_a) {
|
||||
return call$;
|
||||
}
|
||||
}
|
||||
trackBy(context) {
|
||||
if (!this.isHttpApp) {
|
||||
return this.reflector.get(cache_constants_1.CACHE_KEY_METADATA, context.getHandler());
|
||||
}
|
||||
const request = context.getArgByIndex(0);
|
||||
const excludePaths = [];
|
||||
if (this.httpServer.getRequestMethod(request) !== 'GET' ||
|
||||
excludePaths.includes(this.httpServer.getRequestUrl)) {
|
||||
return undefined;
|
||||
}
|
||||
return this.httpServer.getRequestUrl(context.getArgByIndex(0));
|
||||
}
|
||||
};
|
||||
CacheInterceptor = __decorate([
|
||||
decorators_1.Injectable(),
|
||||
__param(0, decorators_1.Optional()),
|
||||
__param(0, decorators_1.Inject(HTTP_SERVER_REF)),
|
||||
__param(1, decorators_1.Inject(cache_constants_1.CACHE_MANAGER)),
|
||||
__param(2, decorators_1.Inject(REFLECTOR)),
|
||||
__metadata("design:paramtypes", [Object, Object, Object])
|
||||
], CacheInterceptor);
|
||||
exports.CacheInterceptor = CacheInterceptor;
|
||||
1
bundle/common/cache/interceptors/index.d.ts
vendored
Normal file
1
bundle/common/cache/interceptors/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './cache.interceptor';
|
||||
6
bundle/common/cache/interceptors/index.js
vendored
Normal file
6
bundle/common/cache/interceptors/index.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./cache.interceptor"));
|
||||
17
bundle/common/cache/interfaces/cache-manager.interface.d.ts
vendored
Normal file
17
bundle/common/cache/interfaces/cache-manager.interface.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface LiteralObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface CacheStore {
|
||||
set<T>(key: string, value: T): Promise<void> | void;
|
||||
get<T>(key: string): Promise<void> | void;
|
||||
del(key: string): void | Promise<void>;
|
||||
}
|
||||
export interface CacheStoreFactory {
|
||||
create(args: LiteralObject): CacheStore;
|
||||
}
|
||||
export interface CacheManagerOptions {
|
||||
store?: string | CacheStoreFactory;
|
||||
ttl?: number;
|
||||
max?: number;
|
||||
isCacheableValue?: (value: any) => boolean;
|
||||
}
|
||||
14
bundle/common/cache/interfaces/cache-module.interface.d.ts
vendored
Normal file
14
bundle/common/cache/interfaces/cache-module.interface.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { ModuleMetadata, Type } from './../../interfaces';
|
||||
import { CacheManagerOptions } from './cache-manager.interface';
|
||||
export interface CacheModuleOptions extends CacheManagerOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface CacheOptionsFactory {
|
||||
createCacheOptions(): Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
}
|
||||
export interface CacheModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
||||
useExisting?: Type<CacheOptionsFactory>;
|
||||
useClass?: Type<CacheOptionsFactory>;
|
||||
useFactory?: (...args: any[]) => Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
inject?: any[];
|
||||
}
|
||||
2
bundle/common/cache/interfaces/index.d.ts
vendored
Normal file
2
bundle/common/cache/interfaces/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './cache-manager.interface';
|
||||
export * from './cache-module.interface';
|
||||
@@ -2,6 +2,7 @@ export declare const metadata: {
|
||||
MODULES: string;
|
||||
IMPORTS: string;
|
||||
COMPONENTS: string;
|
||||
PROVIDERS: string;
|
||||
CONTROLLERS: string;
|
||||
EXPORTS: string;
|
||||
};
|
||||
@@ -10,6 +11,7 @@ export declare const GLOBAL_MODULE_METADATA = "__globalModule__";
|
||||
export declare const PATH_METADATA = "path";
|
||||
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
||||
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
||||
export declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
|
||||
export declare const METHOD_METADATA = "method";
|
||||
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
||||
export declare const CUSTOM_ROUTE_AGRS_METADATA = "__customRouteArgs__";
|
||||
@@ -17,6 +19,10 @@ export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
||||
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
||||
export declare const PIPES_METADATA = "__pipes__";
|
||||
export declare const GUARDS_METADATA = "__guards__";
|
||||
export declare const RENDER_METADATA = "__renderTemplate__";
|
||||
export declare const INTERCEPTORS_METADATA = "__interceptors__";
|
||||
export declare const HTTP_CODE_METADATA = "__httpCode__";
|
||||
export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddlewares";
|
||||
export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddleware";
|
||||
export declare const MODULE_PATH = "__module_path__";
|
||||
export declare const HEADERS_METADATA = "__headers__";
|
||||
export declare const REDIRECT_METADATA = "__redirect__";
|
||||
@@ -4,6 +4,7 @@ exports.metadata = {
|
||||
MODULES: 'modules',
|
||||
IMPORTS: 'imports',
|
||||
COMPONENTS: 'components',
|
||||
PROVIDERS: 'providers',
|
||||
CONTROLLERS: 'controllers',
|
||||
EXPORTS: 'exports',
|
||||
};
|
||||
@@ -12,6 +13,7 @@ exports.GLOBAL_MODULE_METADATA = '__globalModule__';
|
||||
exports.PATH_METADATA = 'path';
|
||||
exports.PARAMTYPES_METADATA = 'design:paramtypes';
|
||||
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
|
||||
exports.OPTIONAL_DEPS_METADATA = 'optional:paramtypes';
|
||||
exports.METHOD_METADATA = 'method';
|
||||
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
|
||||
exports.CUSTOM_ROUTE_AGRS_METADATA = '__customRouteArgs__';
|
||||
@@ -19,6 +21,10 @@ exports.EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
|
||||
exports.FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
|
||||
exports.PIPES_METADATA = '__pipes__';
|
||||
exports.GUARDS_METADATA = '__guards__';
|
||||
exports.RENDER_METADATA = '__renderTemplate__';
|
||||
exports.INTERCEPTORS_METADATA = '__interceptors__';
|
||||
exports.HTTP_CODE_METADATA = '__httpCode__';
|
||||
exports.GATEWAY_MIDDLEWARES = '__gatewayMiddlewares';
|
||||
exports.GATEWAY_MIDDLEWARES = '__gatewayMiddleware';
|
||||
exports.MODULE_PATH = '__module_path__';
|
||||
exports.HEADERS_METADATA = '__headers__';
|
||||
exports.REDIRECT_METADATA = '__redirect__';
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Binds parameters decorators to the method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
export declare function Bind(...decorators: any[]): (target: object, key: any, descriptor: any) => any;
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Binds parameters decorators to the method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
function Bind(...decorators) {
|
||||
7
bundle/common/decorators/core/catch.decorator.d.ts
vendored
Normal file
7
bundle/common/decorators/core/catch.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import 'reflect-metadata';
|
||||
import { Type } from '../../interfaces';
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
export declare function Catch(...exceptions: Type<any>[]): ClassDecorator;
|
||||
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument, which has to be catched by this Filter.
|
||||
* The class should implements the `ExceptionFilter` interface.
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
function Catch(...exceptions) {
|
||||
return (target) => {
|
||||
@@ -1,21 +1,31 @@
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Injectable(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Component(): ClassDecorator;
|
||||
/**
|
||||
* Defines the Pipe. The Pipe should implements the `PipeTransform` interface.
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
export declare function Pipe(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
export declare function Guard(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
export declare function Middleware(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
export declare function Interceptor(): ClassDecorator;
|
||||
66
bundle/common/decorators/core/component.decorator.js
Normal file
66
bundle/common/decorators/core/component.decorator.js
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const uuid = require("uuid/v4");
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Injectable() {
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Component() {
|
||||
deprecate('The @Component() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Component = Component;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
function Pipe() {
|
||||
deprecate('The @Pipe() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Pipe = Pipe;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
function Guard() {
|
||||
deprecate('The @Guard() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Guard = Guard;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
function Middleware() {
|
||||
deprecate('The @Middleware() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Middleware = Middleware;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
function Interceptor() {
|
||||
deprecate('The @Interceptor() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Interceptor = Interceptor;
|
||||
function mixin(mixinClass) {
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: uuid(),
|
||||
});
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Controller(prefix?: string): ClassDecorator;
|
||||
@@ -5,7 +5,7 @@ const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Controller(prefix) {
|
||||
const path = shared_utils_1.isUndefined(prefix) ? '/' : prefix;
|
||||
@@ -1,2 +1,3 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
@@ -2,10 +2,11 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const flatten = arr => {
|
||||
function flatten(arr) {
|
||||
const flat = [].concat(...arr);
|
||||
return flat.some(Array.isArray) ? flatten(flat) : flat;
|
||||
};
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
exports.Dependencies = (...dependencies) => {
|
||||
const flattenDeps = flatten(dependencies);
|
||||
return (target) => {
|
||||
@@ -8,6 +8,6 @@ import { ExceptionFilter } from '../../index';
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters (instances)
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
export declare const UseFilters: (...filters: ExceptionFilter[]) => (target: object, key?: any, descriptor?: any) => any;
|
||||
export declare const UseFilters: (...filters: (Function | ExceptionFilter<any>)[]) => (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const defineFiltersMetadata = (...filters) => {
|
||||
return (target, key, descriptor) => {
|
||||
const isFilterValid = filter => filter && (shared_utils_1.isFunction(filter) || shared_utils_1.isFunction(filter.catch));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
||||
return target;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Setups exception filters to the chosen context.
|
||||
* When the `@UseFilters()` is used on the controller level:
|
||||
* - Exception Filter will be set up to every handler (every method)
|
||||
*
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
exports.UseFilters = (...filters) => defineFiltersMetadata(...filters);
|
||||
@@ -1,11 +1,12 @@
|
||||
export * from './controller.decorator';
|
||||
export * from './component.decorator';
|
||||
export * from './dependencies.decorator';
|
||||
export * from './inject.decorator';
|
||||
export * from './catch.decorator';
|
||||
export * from './exception-filters.decorator';
|
||||
export * from './use-pipes.decorator';
|
||||
export * from './use-guards.decorator';
|
||||
export * from './reflect-metadata.decorator';
|
||||
export * from './use-interceptors.decorator';
|
||||
export * from './bind.decorator';
|
||||
export * from './catch.decorator';
|
||||
export * from './component.decorator';
|
||||
export * from './controller.decorator';
|
||||
export * from './dependencies.decorator';
|
||||
export * from './exception-filters.decorator';
|
||||
export * from './inject.decorator';
|
||||
export * from './optional.decorator';
|
||||
export * from './reflect-metadata.decorator';
|
||||
export * from './use-guards.decorator';
|
||||
export * from './use-interceptors.decorator';
|
||||
export * from './use-pipes.decorator';
|
||||
@@ -3,14 +3,15 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./controller.decorator"));
|
||||
__export(require("./component.decorator"));
|
||||
__export(require("./dependencies.decorator"));
|
||||
__export(require("./inject.decorator"));
|
||||
__export(require("./catch.decorator"));
|
||||
__export(require("./exception-filters.decorator"));
|
||||
__export(require("./use-pipes.decorator"));
|
||||
__export(require("./use-guards.decorator"));
|
||||
__export(require("./reflect-metadata.decorator"));
|
||||
__export(require("./use-interceptors.decorator"));
|
||||
__export(require("./bind.decorator"));
|
||||
__export(require("./catch.decorator"));
|
||||
__export(require("./component.decorator"));
|
||||
__export(require("./controller.decorator"));
|
||||
__export(require("./dependencies.decorator"));
|
||||
__export(require("./exception-filters.decorator"));
|
||||
__export(require("./inject.decorator"));
|
||||
__export(require("./optional.decorator"));
|
||||
__export(require("./reflect-metadata.decorator"));
|
||||
__export(require("./use-guards.decorator"));
|
||||
__export(require("./use-interceptors.decorator"));
|
||||
__export(require("./use-pipes.decorator"));
|
||||
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
export declare function Inject<T = any>(token: T): ParameterDecorator;
|
||||
@@ -4,8 +4,8 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Injects component, which has to be available in the current injector (module) scope.
|
||||
* Components are recognized by types / or tokens.
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
function Inject(token) {
|
||||
return (target, key, index) => {
|
||||
5
bundle/common/decorators/core/optional.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/core/optional.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
*/
|
||||
export declare function Optional(): ParameterDecorator;
|
||||
14
bundle/common/decorators/core/optional.decorator.js
Normal file
14
bundle/common/decorators/core/optional.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
*/
|
||||
function Optional() {
|
||||
return (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
|
||||
Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
|
||||
};
|
||||
}
|
||||
exports.Optional = Optional;
|
||||
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Assigns the metadata to the class/function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
export declare const ReflectMetadata: <K = any, V = any>(metadataKey: K, metadataValue: V) => (target: object, key?: any, descriptor?: any) => any;
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* Assigns the metadata to the class/function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
exports.ReflectMetadata = (metadataKey, metadataValue) => (target, key, descriptor) => {
|
||||
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CanActivate } from '../../interfaces';
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
export declare function UseGuards(...guards: (CanActivate | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
function UseGuards(...guards) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidGuard = guard => guard && (shared_utils_1.isFunction(guard) || shared_utils_1.isFunction(guard.canActivate));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseGuards = UseGuards;
|
||||
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NestInterceptor } from '../../interfaces';
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
export declare function UseInterceptors(...interceptors: (NestInterceptor | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
function UseInterceptors(...interceptors) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidInterceptor = interceptor => interceptor &&
|
||||
(shared_utils_1.isFunction(interceptor) || shared_utils_1.isFunction(interceptor.intercept));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseInterceptors = UseInterceptors;
|
||||
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PipeTransform } from '../../interfaces/index';
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
export declare function UsePipes(...pipes: (PipeTransform | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
function UsePipes(...pipes) {
|
||||
return (target, key, descriptor) => {
|
||||
const isPipeValid = pipe => pipe && (shared_utils_1.isFunction(pipe) || shared_utils_1.isFunction(pipe.transform));
|
||||
if (descriptor) {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UsePipes = UsePipes;
|
||||
15
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
15
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
export declare type ParamDecoratorEnhancer = ParameterDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | any)[]) => ParameterDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;
|
||||
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const uuid = require("uuid/v4");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
|
||||
index,
|
||||
factory,
|
||||
data,
|
||||
pipes,
|
||||
} }));
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory, enhancers = []) {
|
||||
const paramtype = uuid();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const isPipe = pipe => pipe &&
|
||||
((shared_utils_1.isFunction(pipe) && pipe.prototype) || shared_utils_1.isFunction(pipe.transform));
|
||||
const hasParamData = shared_utils_1.isNil(data) || !isPipe(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
|
||||
enhancers.forEach(fn => fn(target, key, index));
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
function createRouteParamDecorator(factory) {
|
||||
deprecate('The "createRouteParamDecorator" function is deprecated and will be removed within next major release. Use "createParamDecorator" instead.');
|
||||
return createParamDecorator(factory);
|
||||
}
|
||||
exports.createRouteParamDecorator = createRouteParamDecorator;
|
||||
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
export declare function Header(name: string, value: string): MethodDecorator;
|
||||
15
bundle/common/decorators/http/header.decorator.js
Normal file
15
bundle/common/decorators/http/header.decorator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
function Header(name, value) {
|
||||
return (target, key, descriptor) => {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Header = Header;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Defines the HTTP status code, which should be sent with response.
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
@@ -2,7 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the HTTP status code, which should be sent with response.
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
@@ -2,3 +2,5 @@ export * from './request-mapping.decorator';
|
||||
export * from './route-params.decorator';
|
||||
export * from './http-code.decorator';
|
||||
export * from './create-route-param-metadata.decorator';
|
||||
export * from './render.decorator';
|
||||
export * from './header.decorator';
|
||||
@@ -7,3 +7,5 @@ __export(require("./request-mapping.decorator"));
|
||||
__export(require("./route-params.decorator"));
|
||||
__export(require("./http-code.decorator"));
|
||||
__export(require("./create-route-param-metadata.decorator"));
|
||||
__export(require("./render.decorator"));
|
||||
__export(require("./header.decorator"));
|
||||
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
export declare function Redirect(url: string): MethodDecorator;
|
||||
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
function Redirect(url) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.REDIRECT_METADATA, url, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Redirect = Redirect;
|
||||
5
bundle/common/decorators/http/render.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/render.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
export declare function Render(template: string): MethodDecorator;
|
||||
14
bundle/common/decorators/http/render.decorator.js
Normal file
14
bundle/common/decorators/http/render.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
function Render(template) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Render = Render;
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
export declare type ParamData = object | string | number;
|
||||
export interface RouteParamsMetadata {
|
||||
[prop: number]: {
|
||||
@@ -11,15 +12,17 @@ export declare const Request: () => ParameterDecorator;
|
||||
export declare const Response: () => ParameterDecorator;
|
||||
export declare const Next: () => ParameterDecorator;
|
||||
export declare const Session: () => ParameterDecorator;
|
||||
export declare const UploadedFile: (fileKey?: string) => ParameterDecorator;
|
||||
export declare const UploadedFiles: () => ParameterDecorator;
|
||||
export declare const Headers: (property?: string) => ParameterDecorator;
|
||||
export declare function Query(): any;
|
||||
export declare function Query(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Query(property: string, ...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(): any;
|
||||
export declare function Body(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Body(property: string, ...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(): any;
|
||||
export declare function Param(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Param(property: string, ...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare const Req: () => ParameterDecorator;
|
||||
export declare const Res: () => ParameterDecorator;
|
||||
@@ -11,21 +11,23 @@ const assignMetadata = (args, paramtype, index, data, ...pipes) => (Object.assig
|
||||
} }));
|
||||
const createRouteParamDecorator = (paramtype) => {
|
||||
return (data) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target, key);
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
||||
};
|
||||
};
|
||||
const createPipesRouteParamDecorator = (paramtype) => (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target, key) || {};
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target, key);
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target.constructor, key);
|
||||
};
|
||||
exports.Request = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.REQUEST);
|
||||
exports.Response = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RESPONSE);
|
||||
exports.Next = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.NEXT);
|
||||
exports.Session = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.SESSION);
|
||||
exports.UploadedFile = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILE);
|
||||
exports.UploadedFiles = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILES);
|
||||
exports.Headers = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.HEADERS);
|
||||
function Query(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.QUERY)(property, ...pipes);
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all of the existing modules.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
export declare function Global(): ClassDecorator;
|
||||
@@ -4,7 +4,7 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all of the existing modules.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
function Global() {
|
||||
return (target) => {
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './module.decorator';
|
||||
export * from './shared.decorator';
|
||||
export * from './single-scope.decorator';
|
||||
export * from './global.decorator';
|
||||
@@ -4,6 +4,5 @@ function __export(m) {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./module.decorator"));
|
||||
__export(require("./shared.decorator"));
|
||||
__export(require("./single-scope.decorator"));
|
||||
__export(require("./global.decorator"));
|
||||
12
bundle/common/decorators/modules/module.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/modules/module.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'reflect-metadata';
|
||||
import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interface';
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
export declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
||||
61
bundle/common/decorators/modules/module.decorator.js
Normal file
61
bundle/common/decorators/modules/module.decorator.js
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const invalid_module_config_exception_1 = require("./exceptions/invalid-module-config.exception");
|
||||
const metadataKeys = [
|
||||
constants_1.metadata.MODULES,
|
||||
constants_1.metadata.IMPORTS,
|
||||
constants_1.metadata.EXPORTS,
|
||||
constants_1.metadata.COMPONENTS,
|
||||
constants_1.metadata.CONTROLLERS,
|
||||
constants_1.metadata.PROVIDERS,
|
||||
];
|
||||
const validateKeys = (keys) => {
|
||||
const isKeyInvalid = key => metadataKeys.findIndex(k => k === key) < 0;
|
||||
const validateKey = key => {
|
||||
if (!isKeyInvalid(key)) {
|
||||
return;
|
||||
}
|
||||
throw new invalid_module_config_exception_1.InvalidModuleConfigException(key);
|
||||
};
|
||||
keys.forEach(validateKey);
|
||||
};
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
function Module(metadata) {
|
||||
const propsKeys = Object.keys(metadata);
|
||||
validateKeys(propsKeys);
|
||||
showDeprecatedWarnings(metadata);
|
||||
overrideModuleMetadata(metadata);
|
||||
return (target) => {
|
||||
for (const property in metadata) {
|
||||
if (metadata.hasOwnProperty(property)) {
|
||||
Reflect.defineMetadata(property, metadata[property], target);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Module = Module;
|
||||
function overrideModuleMetadata(moduleMetadata) {
|
||||
moduleMetadata.modules = moduleMetadata.imports
|
||||
? moduleMetadata.imports
|
||||
: moduleMetadata.modules;
|
||||
moduleMetadata.components = moduleMetadata.providers
|
||||
? moduleMetadata.providers
|
||||
: moduleMetadata.components;
|
||||
}
|
||||
function showDeprecatedWarnings(moduleMetadata) {
|
||||
const modulesDeprecatedWarning = 'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
|
||||
const componentsDeprecatetWarning = 'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
|
||||
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* Nest will always create the new instance of the module, when it's imported by another one.
|
||||
* In this case, Nest will always create a new instance of this particular module when it's imported by another one.
|
||||
*/
|
||||
export declare function SingleScope(): ClassDecorator;
|
||||
@@ -4,7 +4,7 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* Nest will always create the new instance of the module, when it's imported by another one.
|
||||
* In this case, Nest will always create a new instance of this particular module when it's imported by another one.
|
||||
*/
|
||||
function SingleScope() {
|
||||
return (target) => {
|
||||
@@ -34,6 +34,7 @@ export declare enum HttpStatus {
|
||||
UNSUPPORTED_MEDIA_TYPE = 415,
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
||||
EXPECTATION_FAILED = 417,
|
||||
I_AM_A_TEAPOT = 418,
|
||||
UNPROCESSABLE_ENTITY = 422,
|
||||
TOO_MANY_REQUESTS = 429,
|
||||
INTERNAL_SERVER_ERROR = 500,
|
||||
@@ -37,6 +37,7 @@ var HttpStatus;
|
||||
HttpStatus[HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
||||
HttpStatus[HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
||||
HttpStatus[HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
||||
HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
||||
HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
||||
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
||||
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user