mirror of
https://github.com/nestjs/nest.git
synced 2026-02-24 00:02:56 +00:00
Compare commits
539 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd30d7a4a5 | ||
|
|
a6d837e64a | ||
|
|
0904b0ba56 | ||
|
|
150c81e397 | ||
|
|
1717f35717 | ||
|
|
61b6b346da | ||
|
|
b02fb57d8f | ||
|
|
cb302e6719 | ||
|
|
1f9030c504 | ||
|
|
af5a4af675 | ||
|
|
664321465c | ||
|
|
f6d4b5e82a | ||
|
|
09c9f704e5 | ||
|
|
8a8b780273 | ||
|
|
1f0de4923e | ||
|
|
d5833e3e4b | ||
|
|
deffcdcd84 | ||
|
|
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 | ||
|
|
b6cba3784d | ||
|
|
957929e31d | ||
|
|
4bcfe79e07 | ||
|
|
77b778f044 | ||
|
|
466dc841c0 | ||
|
|
5caef83200 | ||
|
|
6cbe49604c | ||
|
|
3bb2e2489e | ||
|
|
e57203c2b8 | ||
|
|
23624dec23 | ||
|
|
37392212c9 | ||
|
|
4d32bc3508 | ||
|
|
4359785f5b | ||
|
|
ceb0ecbdcd | ||
|
|
df48878d6b | ||
|
|
cfa9115526 | ||
|
|
496285d9d1 | ||
|
|
acbb857fcd | ||
|
|
6e9f432d06 | ||
|
|
9e3b07de6f | ||
|
|
46a961c8d7 | ||
|
|
e12141dc70 | ||
|
|
e9dcac6124 | ||
|
|
ab86e44f0a | ||
|
|
5ed8c5980b | ||
|
|
601de0fe46 | ||
|
|
3150c19a8e | ||
|
|
5e58318894 | ||
|
|
13ddd03356 | ||
|
|
606557864b | ||
|
|
ad3f679c5a | ||
|
|
2b1898c00b | ||
|
|
74d6c37c8b | ||
|
|
d2875bfcab | ||
|
|
200e6cb673 | ||
|
|
e83aca183d | ||
|
|
2a6ca015fc | ||
|
|
864fac9cea | ||
|
|
2a727b9024 | ||
|
|
d7b0e0557b | ||
|
|
52e0128258 | ||
|
|
bb0ce8ce3f | ||
|
|
8afafc6c34 | ||
|
|
028c8aacf0 | ||
|
|
b605b8871e | ||
|
|
81be8a0fbc | ||
|
|
27b54d567a | ||
|
|
4d4f7a448c | ||
|
|
ade7aed794 | ||
|
|
fe24ae456b | ||
|
|
3e0ee2108f | ||
|
|
49bb841615 | ||
|
|
ca3ff1b2d8 | ||
|
|
62adce80c8 | ||
|
|
e22d2beb17 | ||
|
|
fb836bccee | ||
|
|
4795b8f209 | ||
|
|
910e089a9b | ||
|
|
b7268e145a | ||
|
|
a11186048a | ||
|
|
8b825b6031 | ||
|
|
fece41a0fe | ||
|
|
853c3c96f3 | ||
|
|
2bca46d3d5 | ||
|
|
0bf4de8ef7 | ||
|
|
3747abc32a | ||
|
|
256d1aa054 | ||
|
|
147410972d | ||
|
|
64e6b1717b | ||
|
|
6a2b5a950a | ||
|
|
f5c50fd377 | ||
|
|
7e9cca06e3 | ||
|
|
243c83dc67 | ||
|
|
f2b565c8a0 | ||
|
|
bffe159a59 | ||
|
|
4cde98de58 | ||
|
|
88cf09a404 | ||
|
|
106af4f7bb | ||
|
|
82cb61aa2b | ||
|
|
447b8ab624 | ||
|
|
5b92c33cb2 | ||
|
|
77817b232f | ||
|
|
40194281b1 | ||
|
|
2984df1395 | ||
|
|
c4a3e0296d |
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
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,8 +7,10 @@ node_modules/
|
||||
/.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
|
||||
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
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
|
||||
256
CHANGELOG.md
256
CHANGELOG.md
@@ -1,256 +0,0 @@
|
||||
# 4.4.0 @soon
|
||||
- **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
|
||||
271
CONTRIBUTING.md
Normal file
271
CONTRIBUTING.md
Normal file
@@ -0,0 +1,271 @@
|
||||
# Contributing to Nest
|
||||
|
||||
We would love for you to contribute to Nest and help make it even better than it is
|
||||
today! As a contributor, here are the guidelines we would like you to follow:
|
||||
|
||||
- [Code of Conduct](#coc)
|
||||
- [Question or Problem?](#question)
|
||||
- [Issues and Bugs](#issue)
|
||||
- [Feature Requests](#feature)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Coding Rules](#rules)
|
||||
- [Commit Message Guidelines](#commit)
|
||||
<!-- - [Signing the CLA](#cla) -->
|
||||
|
||||
<!-- ## <a name="coc"></a> Code of Conduct
|
||||
Help us keep Nest open and inclusive. Please read and follow our [Code of Conduct][coc]. -->
|
||||
|
||||
## <a name="question"></a> Got a Question or Problem?
|
||||
|
||||
**Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.** You've got much better chances of getting your question answered on [Stack Overflow](https://stackoverflow.com/questions/tagged/nestjs) where the questions should be tagged with tag `nestjs`.
|
||||
|
||||
Stack Overflow is a much better place to ask questions since:
|
||||
|
||||
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
|
||||
- questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
- Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
|
||||
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
|
||||
|
||||
If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
|
||||
|
||||
## <a name="issue"></a> Found a Bug?
|
||||
If you find a bug in the source code, you can help us by
|
||||
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
|
||||
[submit a Pull Request](#submit-pr) with a fix.
|
||||
|
||||
## <a name="feature"></a> Missing a Feature?
|
||||
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
|
||||
Repository. If you would like to *implement* a new feature, please submit an issue with
|
||||
a proposal for your work first, to be sure that we can use it.
|
||||
Please consider what kind of change it is:
|
||||
|
||||
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
|
||||
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
|
||||
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
|
||||
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
|
||||
|
||||
## <a name="submit"></a> Submission Guidelines
|
||||
|
||||
### <a name="submit-issue"></a> Submitting an Issue
|
||||
|
||||
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
|
||||
|
||||
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
|
||||
|
||||
- version of NestJS used
|
||||
- 3rd-party libraries and their versions
|
||||
- and most importantly - a use-case that fails
|
||||
|
||||
<!--
|
||||
// TODO we need to create a playground, similar to plunkr
|
||||
|
||||
A minimal reproduce scenario using a repository or Gist allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. If neither of these are not a suitable way to demonstrate the problem (for example for issues related to our npm packaging), please create a standalone git repository demonstrating the problem. -->
|
||||
|
||||
<!-- We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it. -->
|
||||
|
||||
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that don't have enough info to be reproduced.
|
||||
|
||||
You can file new issues by filling out our [new issue form](https://github.com/nestjs/nest/issues/new).
|
||||
|
||||
|
||||
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
|
||||
Before you submit your Pull Request (PR) consider the following guidelines:
|
||||
|
||||
1. Search [GitHub](https://github.com/nestjs/nest/pulls) for an open or closed PR
|
||||
that relates to your submission. You don't want to duplicate effort.
|
||||
<!-- 1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
|
||||
We cannot accept code without this. -->
|
||||
1. Fork the nestjs/nest repo.
|
||||
1. Make your changes in a new git branch:
|
||||
|
||||
```shell
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
|
||||
1. Create your patch, **including appropriate test cases**.
|
||||
1. Follow our [Coding Rules](#rules).
|
||||
1. Run the full Nest test suite, as described in the [developer documentation][dev-doc],
|
||||
and ensure that all tests pass.
|
||||
1. Commit your changes using a descriptive commit message that follows our
|
||||
[commit message conventions](#commit). Adherence to these conventions
|
||||
is necessary because release notes are automatically generated from these messages.
|
||||
|
||||
```shell
|
||||
git commit -a
|
||||
```
|
||||
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
|
||||
|
||||
1. Push your branch to GitHub:
|
||||
|
||||
```shell
|
||||
git push origin my-fix-branch
|
||||
```
|
||||
|
||||
1. In GitHub, send a pull request to `nestjs:master`.
|
||||
* If we suggest changes then:
|
||||
* Make the required updates.
|
||||
* Re-run the Nest test suites to ensure tests are still passing.
|
||||
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
|
||||
```shell
|
||||
git rebase master -i
|
||||
git push -f
|
||||
```
|
||||
|
||||
That's it! Thank you for your contribution!
|
||||
|
||||
#### After your pull request is merged
|
||||
|
||||
After your pull request is merged, you can safely delete your branch and pull the changes
|
||||
from the main (upstream) repository:
|
||||
|
||||
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
|
||||
|
||||
```shell
|
||||
git push origin --delete my-fix-branch
|
||||
```
|
||||
|
||||
* Check out the master branch:
|
||||
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
|
||||
* Delete the local branch:
|
||||
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
|
||||
* Update your master with the latest upstream version:
|
||||
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
|
||||
## <a name="rules"></a> Coding Rules
|
||||
To ensure consistency throughout the source code, keep these rules in mind as you are working:
|
||||
|
||||
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
|
||||
<!--
|
||||
// We're working on auto-documentation.
|
||||
* All public API methods **must be documented**. (Details TBC). -->
|
||||
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
|
||||
**100 characters**. An automated formatter is available, see
|
||||
[DEVELOPER.md](docs/DEVELOPER.md#clang-format).
|
||||
|
||||
## <a name="commit"></a> Commit Message Guidelines
|
||||
|
||||
We have very precise rules over how our git commit messages can be formatted. This leads to **more
|
||||
readable messages** that are easy to follow when looking through the **project history**. But also,
|
||||
we use the git commit messages to **generate the Nest change log**.
|
||||
|
||||
### Commit Message Format
|
||||
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
|
||||
format that includes a **type**, a **scope** and a **subject**:
|
||||
|
||||
```
|
||||
<type>(<scope>): <subject>
|
||||
<BLANK LINE>
|
||||
<body>
|
||||
<BLANK LINE>
|
||||
<footer>
|
||||
```
|
||||
|
||||
The **header** is mandatory and the **scope** of the header is optional.
|
||||
|
||||
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
|
||||
to read on GitHub as well as in various git tools.
|
||||
|
||||
Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
|
||||
|
||||
Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
|
||||
|
||||
```
|
||||
docs(changelog) update change log to beta.5
|
||||
```
|
||||
```
|
||||
bugfix(@nestjs/core) need to depend on latest rxjs and zone.js
|
||||
|
||||
The version in our package.json gets copied to the one we publish, and users need the latest of these.
|
||||
```
|
||||
|
||||
### Revert
|
||||
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
|
||||
### Type
|
||||
Must be one of the following:
|
||||
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **docs**: Documentation only changes
|
||||
* **feature**: A new feature
|
||||
* **bugfix**: A bug fix
|
||||
* **perf**: A code change that improves performance
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* **test**: Adding missing tests or correcting existing tests
|
||||
|
||||
### Scope
|
||||
The scope should be the name of the npm package affected (as perceived by person reading changelog generated from commit messages.
|
||||
|
||||
The following is the list of supported scopes:
|
||||
|
||||
* **common**
|
||||
* **core**
|
||||
* **sample**
|
||||
* **microservices**
|
||||
* **testing**
|
||||
* **websockets**
|
||||
|
||||
There are currently a few exceptions to the "use package name" rule:
|
||||
|
||||
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
* **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
* **sample/#**: for the example apps directory, replacing # with the example app number
|
||||
<!-- * **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`)
|
||||
|
||||
### Subject
|
||||
The subject contains succinct description of the change:
|
||||
|
||||
* use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
* don't capitalize first letter
|
||||
* no dot (.) at the end
|
||||
|
||||
### Body
|
||||
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
|
||||
The body should include the motivation for the change and contrast this with previous behavior.
|
||||
|
||||
### Footer
|
||||
The footer should contain any information about **Breaking Changes** and is also the place to
|
||||
reference GitHub issues that this commit **Closes**.
|
||||
|
||||
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
||||
|
||||
A detailed explanation can be found in this [document][commit-message-format].
|
||||
|
||||
<!-- ## <a name="cla"></a> Signing the CLA
|
||||
|
||||
Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
|
||||
changes to be accepted, the CLA must be signed. It's a quick process, we promise!
|
||||
|
||||
* For individuals we have a [simple click-through form][individual-cla].
|
||||
* For corporations we'll need you to
|
||||
[print, sign and one of scan+email, fax or mail the form][corporate-cla]. -->
|
||||
|
||||
|
||||
<!-- [angular-group]: https://groups.google.com/forum/#!forum/angular -->
|
||||
<!-- [coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md -->
|
||||
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
|
||||
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
|
||||
[dev-doc]: https://github.com/nestjs/nest/blob/master/docs/DEVELOPER.md
|
||||
[github]: https://github.com/nestjs/nest
|
||||
[gitter]: https://gitter.im/nestjs/nest
|
||||
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
|
||||
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
|
||||
[jsfiddle]: http://jsfiddle.net
|
||||
[plunker]: http://plnkr.co/edit
|
||||
[runnable]: http://runnable.com
|
||||
<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->
|
||||
111
Readme.md
111
Readme.md
@@ -1,126 +1,75 @@
|
||||
<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 web applications. :cat: </p>
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, 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#4" 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)-->
|
||||
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> web 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>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>
|
||||
|
||||
## Features
|
||||
## Getting started
|
||||
|
||||
<ul>
|
||||
<li>Built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (compatible with pure JavaScript + <a href="http://babeljs.io/" target="_blank">Babel</a>)</li>
|
||||
<li><strong>Easy</strong> to learn - syntax similar to <a href="https://angular.io/" target="_blank">Angular</a></li>
|
||||
<li><strong>Familiar</strong> - based on well-known libraries (<a href="https://github.com/expressjs/express" target="_blank">Express</a> / <a href="https://github.com/socketio/socket.io" target="_blank">socket.io</a>)</li>
|
||||
<li><strong>Dependency Injection</strong> - built-in asynchronous <strong>IoC</strong> container with a <strong>hierarchical injector</strong></li>
|
||||
<li><strong>WebSockets</strong> module (based on <a href="https://github.com/socketio/socket.io" target="_blank">socket.io</a>, but you can bring your own library, by making use of <code>WsAdapter</code>)</li>
|
||||
<li><strong>Modular</strong> - defines an easy to follow module definition pattern so you can split your system into reusable modules</li>
|
||||
<li><strong>Reactive microservice</strong> support with message patterns (built-in transport via TCP / <a href="https://redis.io/" target="_blank">Redis</a>, but other communication schemes can be implemented with <code>CustomTransportStrategy</code>)</li>
|
||||
<li><strong>Exception layer</strong> - throwable web exceptions with status codes, exception filters</li>
|
||||
<li><strong>Pipes</strong> - synchronous & asynchronous (e.g. validation purposes)</li>
|
||||
<li><strong>Guards</strong> - attach additional logic in a declarative manner (e.g. role-based access control)</li>
|
||||
<li><strong>Interceptors</strong> - built on top of <a href="https://github.com/reactivex/rxjs" target="blank">RxJS</a></li>
|
||||
<li>Testing utilities (both <strong>e2e & unit</strong> tests)</li>
|
||||
<li><strong>More</strong>!</li>
|
||||
</ul>
|
||||
* 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:
|
||||
|
||||
## Installation
|
||||
## Support
|
||||
|
||||
**Install the TypeScript Starter Project with Git:**
|
||||
```bash
|
||||
$ git clone https://github.com/nestjs/typescript-starter.git project
|
||||
$ cd project
|
||||
$ npm install
|
||||
$ npm run start
|
||||
```
|
||||
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).
|
||||
|
||||
**Install the JavaScript (Babel) Starter Project with Git:**
|
||||
```bash
|
||||
$ git clone https://github.com/nestjs/javascript-starter.git project
|
||||
$ cd project
|
||||
$ npm install
|
||||
$ npm run start
|
||||
```
|
||||
#### Principal Sponsor
|
||||
|
||||
**Start a New Project from Scratch with NPM:**
|
||||
```bash
|
||||
$ npm i --save @nestjs/core @nestjs/common @nestjs/microservices @nestjs/websockets @nestjs/testing reflect-metadata rxjs
|
||||
```
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
|
||||
|
||||
## Documentation & Quick Start
|
||||
#### Gold Sponsors
|
||||
|
||||
:books: [Documentation & Tutorial](https://docs.nestjs.com)
|
||||
<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>
|
||||
|
||||
## Sponsors
|
||||
#### Silver Sponsors
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="210" /></a>
|
||||
<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
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the support by these awesome people. If you'd like to join them, please [read more here](https://opencollective.com/nest#backer). Thanks! :heart_eyes:
|
||||
<a href="https://opencollective.com/nest"><img src="https://opencollective.com/nest/backers.svg?width=890"></a>
|
||||
|
||||
<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>
|
||||
## Stay in touch
|
||||
|
||||
## People
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](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).
|
||||
@@ -1,13 +1,17 @@
|
||||
export declare const metadata: {
|
||||
MODULES: string;
|
||||
IMPORTS: string;
|
||||
COMPONENTS: string;
|
||||
PROVIDERS: string;
|
||||
CONTROLLERS: string;
|
||||
EXPORTS: string;
|
||||
};
|
||||
export declare const SHARED_MODULE_METADATA = "__sharedModule__";
|
||||
export declare const GLOBAL_MODULE_METADATA = "__globalModule__";
|
||||
export declare const PATH_METADATA = "path";
|
||||
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
||||
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
||||
export declare const 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__";
|
||||
@@ -15,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__";
|
||||
@@ -2,14 +2,18 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.metadata = {
|
||||
MODULES: 'modules',
|
||||
IMPORTS: 'imports',
|
||||
COMPONENTS: 'components',
|
||||
PROVIDERS: 'providers',
|
||||
CONTROLLERS: 'controllers',
|
||||
EXPORTS: 'exports',
|
||||
};
|
||||
exports.SHARED_MODULE_METADATA = '__sharedModule__';
|
||||
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__';
|
||||
@@ -17,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;
|
||||
14
bundle/common/decorators/core/bind.decorator.js
Normal file
14
bundle/common/decorators/core/bind.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* 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) {
|
||||
return (target, key, descriptor) => {
|
||||
decorators.forEach((fn, index) => fn(target, key, index));
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Bind = Bind;
|
||||
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;
|
||||
14
bundle/common/decorators/core/catch.decorator.js
Normal file
14
bundle/common/decorators/core/catch.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 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) => {
|
||||
Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
|
||||
};
|
||||
}
|
||||
exports.Catch = Catch;
|
||||
32
bundle/common/decorators/core/component.decorator.d.ts
vendored
Normal file
32
bundle/common/decorators/core/component.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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 have to belong to the same module.
|
||||
*/
|
||||
export declare function Component(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
export declare function Pipe(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
export declare function Guard(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
export declare function Middleware(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
export declare function Interceptor(): ClassDecorator;
|
||||
export declare function mixin(mixinClass: any): any;
|
||||
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");
|
||||
/**
|
||||
* 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;
|
||||
let offset = Math.random() * 100;
|
||||
function mixin(mixinClass) {
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: JSON.stringify(offset++),
|
||||
});
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
6
bundle/common/decorators/core/controller.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/controller.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Controller(prefix?: string): ClassDecorator;
|
||||
16
bundle/common/decorators/core/controller.decorator.js
Normal file
16
bundle/common/decorators/core/controller.decorator.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
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 have to belong to the same module.
|
||||
*/
|
||||
function Controller(prefix) {
|
||||
const path = shared_utils_1.isUndefined(prefix) ? '/' : prefix;
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.PATH_METADATA, path, target);
|
||||
};
|
||||
}
|
||||
exports.Controller = Controller;
|
||||
3
bundle/common/decorators/core/dependencies.decorator.d.ts
vendored
Normal file
3
bundle/common/decorators/core/dependencies.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
15
bundle/common/decorators/core/dependencies.decorator.js
Normal file
15
bundle/common/decorators/core/dependencies.decorator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
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) => {
|
||||
Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, flattenDeps, target);
|
||||
};
|
||||
};
|
||||
13
bundle/common/decorators/core/exception-filters.decorator.d.ts
vendored
Normal file
13
bundle/common/decorators/core/exception-filters.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'reflect-metadata';
|
||||
import { ExceptionFilter } from '../../index';
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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);
|
||||
12
bundle/common/decorators/core/index.d.ts
vendored
Normal file
12
bundle/common/decorators/core/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
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';
|
||||
17
bundle/common/decorators/core/index.js
Normal file
17
bundle/common/decorators/core/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
"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("./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;
|
||||
18
bundle/common/decorators/core/inject.decorator.js
Normal file
18
bundle/common/decorators/core/inject.decorator.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* 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) => {
|
||||
const args = Reflect.getMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, target) || [];
|
||||
const type = shared_utils_1.isFunction(token) ? token.name : token;
|
||||
args.push({ index, param: type });
|
||||
Reflect.defineMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, args, target);
|
||||
};
|
||||
}
|
||||
exports.Inject = Inject;
|
||||
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,8 +1,10 @@
|
||||
"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.
|
||||
*/
|
||||
export const ReflectMetadata = (metadataKey, metadataValue) => (target: object, key?, descriptor?) => {
|
||||
exports.ReflectMetadata = (metadataKey, metadataValue) => (target, key, descriptor) => {
|
||||
if (descriptor) {
|
||||
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
|
||||
return 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 | string)[]) => 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 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,
|
||||
} }));
|
||||
const randomString = () => Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory, enhancers = []) {
|
||||
const paramtype = randomString() + randomString();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
|
||||
enhancers.forEach(fn => fn(target, key, index));
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* 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;
|
||||
7
bundle/common/decorators/http/http-code.decorator.d.ts
vendored
Normal file
7
bundle/common/decorators/http/http-code.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
*/
|
||||
export declare function HttpCode(statusCode: number): MethodDecorator;
|
||||
16
bundle/common/decorators/http/http-code.decorator.js
Normal file
16
bundle/common/decorators/http/http-code.decorator.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
*/
|
||||
function HttpCode(statusCode) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.HTTP_CODE_METADATA, statusCode, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.HttpCode = HttpCode;
|
||||
6
bundle/common/decorators/http/index.d.ts
vendored
Normal file
6
bundle/common/decorators/http/index.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
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';
|
||||
11
bundle/common/decorators/http/index.js
Normal file
11
bundle/common/decorators/http/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"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("./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;
|
||||
28
bundle/common/decorators/http/route-params.decorator.d.ts
vendored
Normal file
28
bundle/common/decorators/http/route-params.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'reflect-metadata';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
export declare type ParamData = object | string | number;
|
||||
export interface RouteParamsMetadata {
|
||||
[prop: number]: {
|
||||
index: number;
|
||||
data?: ParamData;
|
||||
};
|
||||
}
|
||||
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: (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: (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: (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;
|
||||
45
bundle/common/decorators/http/route-params.decorator.js
Normal file
45
bundle/common/decorators/http/route-params.decorator.js
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const route_paramtypes_enum_1 = require("../../enums/route-paramtypes.enum");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const assignMetadata = (args, paramtype, index, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}:${index}`]: {
|
||||
index,
|
||||
data,
|
||||
pipes,
|
||||
} }));
|
||||
const createRouteParamDecorator = (paramtype) => {
|
||||
return (data) => (target, key, index) => {
|
||||
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.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.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);
|
||||
}
|
||||
exports.Query = Query;
|
||||
function Body(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.BODY)(property, ...pipes);
|
||||
}
|
||||
exports.Body = Body;
|
||||
function Param(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.PARAM)(property, ...pipes);
|
||||
}
|
||||
exports.Param = Param;
|
||||
exports.Req = exports.Request;
|
||||
exports.Res = exports.Response;
|
||||
3
bundle/common/decorators/index.d.ts
vendored
Normal file
3
bundle/common/decorators/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './core';
|
||||
export * from './modules';
|
||||
export * from './http';
|
||||
8
bundle/common/decorators/index.js
Normal file
8
bundle/common/decorators/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
"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("./core"));
|
||||
__export(require("./modules"));
|
||||
__export(require("./http"));
|
||||
6
bundle/common/decorators/modules/global.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/modules/global.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
export declare function Global(): ClassDecorator;
|
||||
14
bundle/common/decorators/modules/global.decorator.js
Normal file
14
bundle/common/decorators/modules/global.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
function Global() {
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.GLOBAL_MODULE_METADATA, true, target);
|
||||
};
|
||||
}
|
||||
exports.Global = Global;
|
||||
3
bundle/common/decorators/modules/index.d.ts
vendored
Normal file
3
bundle/common/decorators/modules/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './module.decorator';
|
||||
export * from './single-scope.decorator';
|
||||
export * from './global.decorator';
|
||||
8
bundle/common/decorators/modules/index.js
Normal file
8
bundle/common/decorators/modules/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
"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("./module.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);
|
||||
}
|
||||
6
bundle/common/decorators/modules/single-scope.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/modules/single-scope.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* 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;
|
||||
22
bundle/common/decorators/modules/single-scope.decorator.js
Normal file
22
bundle/common/decorators/modules/single-scope.decorator.js
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* 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) => {
|
||||
const Metatype = target;
|
||||
const Type = class extends Metatype {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
}
|
||||
};
|
||||
Reflect.defineMetadata(constants_1.SHARED_MODULE_METADATA, true, Type);
|
||||
Object.defineProperty(Type, 'name', { value: target.name });
|
||||
return Type;
|
||||
};
|
||||
}
|
||||
exports.SingleScope = SingleScope;
|
||||
@@ -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";
|
||||
@@ -7,4 +7,6 @@ export declare enum RouteParamtypes {
|
||||
PARAM = 5,
|
||||
HEADERS = 6,
|
||||
SESSION = 7,
|
||||
FILE = 8,
|
||||
FILES = 9,
|
||||
}
|
||||
@@ -10,4 +10,6 @@ var RouteParamtypes;
|
||||
RouteParamtypes[RouteParamtypes["PARAM"] = 5] = "PARAM";
|
||||
RouteParamtypes[RouteParamtypes["HEADERS"] = 6] = "HEADERS";
|
||||
RouteParamtypes[RouteParamtypes["SESSION"] = 7] = "SESSION";
|
||||
RouteParamtypes[RouteParamtypes["FILE"] = 8] = "FILE";
|
||||
RouteParamtypes[RouteParamtypes["FILES"] = 9] = "FILES";
|
||||
})(RouteParamtypes = exports.RouteParamtypes || (exports.RouteParamtypes = {}));
|
||||
@@ -1,4 +1,7 @@
|
||||
export declare enum Transport {
|
||||
TCP = 0,
|
||||
REDIS = 1,
|
||||
NATS = 2,
|
||||
MQTT = 3,
|
||||
GRPC = 4,
|
||||
}
|
||||
@@ -4,4 +4,7 @@ var Transport;
|
||||
(function (Transport) {
|
||||
Transport[Transport["TCP"] = 0] = "TCP";
|
||||
Transport[Transport["REDIS"] = 1] = "REDIS";
|
||||
Transport[Transport["NATS"] = 2] = "NATS";
|
||||
Transport[Transport["MQTT"] = 3] = "MQTT";
|
||||
Transport[Transport["GRPC"] = 4] = "GRPC";
|
||||
})(Transport = exports.Transport || (exports.Transport = {}));
|
||||
@@ -1,6 +1,7 @@
|
||||
export declare class HttpException {
|
||||
export declare class HttpException extends Error {
|
||||
private readonly response;
|
||||
private readonly status;
|
||||
readonly message: any;
|
||||
/**
|
||||
* The base Nest Application exception, which is handled by the default Exceptions Handler.
|
||||
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class HttpException {
|
||||
class HttpException extends Error {
|
||||
/**
|
||||
* The base Nest Application exception, which is handled by the default Exceptions Handler.
|
||||
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
@@ -16,8 +16,10 @@ class HttpException {
|
||||
* ```
|
||||
*/
|
||||
constructor(response, status) {
|
||||
super();
|
||||
this.response = response;
|
||||
this.status = status;
|
||||
this.message = response;
|
||||
}
|
||||
getResponse() {
|
||||
return this.response;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user