mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 07:21:39 +00:00
Compare commits
194 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47f0fa0ab5 | ||
|
|
9be35b4c10 | ||
|
|
dd38a49508 | ||
|
|
b55ee078b2 | ||
|
|
6eec6016a4 | ||
|
|
9b799ba3c1 | ||
|
|
a2ed524824 | ||
|
|
82bf25b707 | ||
|
|
ffea148892 | ||
|
|
b0026d8cc1 | ||
|
|
313e22632b | ||
|
|
a299b12ad5 | ||
|
|
6635d2cbe1 | ||
|
|
9972649770 | ||
|
|
92cd57a19b | ||
|
|
6ac9968ec0 | ||
|
|
9210dc1318 | ||
|
|
a850d5d322 | ||
|
|
b0e4383e6e | ||
|
|
935aa704fc | ||
|
|
f0512d2a26 | ||
|
|
6f9b242410 | ||
|
|
e1a9643887 | ||
|
|
b03e36c692 | ||
|
|
2383cdb412 | ||
|
|
e9433d0fb5 | ||
|
|
13d473fcba | ||
|
|
a78a31eff2 | ||
|
|
bd05652cbe | ||
|
|
96b0a194af | ||
|
|
64555bf428 | ||
|
|
6f18afc036 | ||
|
|
21bdbac788 | ||
|
|
b6d059fc30 | ||
|
|
a6b001638f | ||
|
|
3e9bfff04e | ||
|
|
186f018d76 | ||
|
|
6dda6c58c5 | ||
|
|
bf02e984ac | ||
|
|
da8612b4d6 | ||
|
|
63ae5b16e2 | ||
|
|
e9e277c21c | ||
|
|
ceabe7418a | ||
|
|
84aa4dec09 | ||
|
|
40e90516f0 | ||
|
|
35cf1faa84 | ||
|
|
72a8725b21 | ||
|
|
5d27183295 | ||
|
|
3a0f461a56 | ||
|
|
72616cc0f1 | ||
|
|
0e71949538 | ||
|
|
04fe22b44e | ||
|
|
06d0f12169 | ||
|
|
1eef51345f | ||
|
|
b2f3dfe0b3 | ||
|
|
d49a265686 | ||
|
|
51b93e5306 | ||
|
|
656ecf831c | ||
|
|
e6dfef8480 | ||
|
|
096336c243 | ||
|
|
fb052ab971 | ||
|
|
84df209740 | ||
|
|
457c57b9dc | ||
|
|
098afe6b85 | ||
|
|
3e42f9b91d | ||
|
|
85d7384b5e | ||
|
|
3e851e5652 | ||
|
|
e391936e69 | ||
|
|
6c92bf72ef | ||
|
|
81fe7124bc | ||
|
|
20a5e7e77a | ||
|
|
eba4102b2a | ||
|
|
402d83ff9e | ||
|
|
227d4fba56 | ||
|
|
62e0283098 | ||
|
|
8a827ff9fc | ||
|
|
66ee3ebe72 | ||
|
|
91be484b83 | ||
|
|
8ec7c5b31e | ||
|
|
7c2143f889 | ||
|
|
89d84d214f | ||
|
|
f8ffc2d064 | ||
|
|
d453e9bc65 | ||
|
|
3a74c790bf | ||
|
|
0c8e6968bd | ||
|
|
4a8c8bc740 | ||
|
|
47a17e85e4 | ||
|
|
f45021e7cb | ||
|
|
958da96733 | ||
|
|
1acae78302 | ||
|
|
f01d60021c | ||
|
|
945eff5274 | ||
|
|
9e8eff09bf | ||
|
|
b90842048b | ||
|
|
cce8c45f6f | ||
|
|
ac5a556a3c | ||
|
|
bf945310b5 | ||
|
|
4e943dbaae | ||
|
|
ac295e68f6 | ||
|
|
31c2b87a6a | ||
|
|
6193f506c2 | ||
|
|
34f72ce4a7 | ||
|
|
63947cd3c0 | ||
|
|
14cc3edb10 | ||
|
|
65bb7e7c34 | ||
|
|
8604f25a20 | ||
|
|
57faedcc98 | ||
|
|
515151660b | ||
|
|
7f124f9d92 | ||
|
|
9ffbbad4e8 | ||
|
|
de9664831c | ||
|
|
26eeeb598e | ||
|
|
49f97cf72c | ||
|
|
15a6d890a5 | ||
|
|
a3c1bdc061 | ||
|
|
b75460b34f | ||
|
|
25a3684dcf | ||
|
|
9e322c1ed1 | ||
|
|
767ccd3e92 | ||
|
|
0368d5267c | ||
|
|
005d16f447 | ||
|
|
d37ec239c4 | ||
|
|
558e33f25c | ||
|
|
5172ef3c49 | ||
|
|
cdccb8ed97 | ||
|
|
4d407ab239 | ||
|
|
58120783d5 | ||
|
|
9732e8a0f4 | ||
|
|
dabf8a24c7 | ||
|
|
447372a485 | ||
|
|
4b042af629 | ||
|
|
ff828b9e86 | ||
|
|
806f079c2c | ||
|
|
a2880d02bd | ||
|
|
ce498e8615 | ||
|
|
14f737f770 | ||
|
|
a9922dab23 | ||
|
|
b1f7096432 | ||
|
|
d5dca175d7 | ||
|
|
66c0b8cf5c | ||
|
|
e3356cf19e | ||
|
|
4b6ca2a3e0 | ||
|
|
137e8fd408 | ||
|
|
03f2832a2d | ||
|
|
d9a9e7df2f | ||
|
|
a3fe26babf | ||
|
|
71cc0dea61 | ||
|
|
6198204b0b | ||
|
|
32953148df | ||
|
|
603ed2de28 | ||
|
|
b272ec313b | ||
|
|
25588d83d0 | ||
|
|
d4c0969f1a | ||
|
|
2d942a8405 | ||
|
|
e0f5e1d5ca | ||
|
|
e8c815d8ec | ||
|
|
149176ae6f | ||
|
|
fa3ee7e2aa | ||
|
|
d5880506df | ||
|
|
dfd0d17126 | ||
|
|
9638c18020 | ||
|
|
17c5044bae | ||
|
|
9ef356b30f | ||
|
|
1a7ab4e5f9 | ||
|
|
6099f9ec1b | ||
|
|
c5da005d81 | ||
|
|
76beabe686 | ||
|
|
e766ea72ba | ||
|
|
2f535c33ae | ||
|
|
20dd9fc8ca | ||
|
|
6110526402 | ||
|
|
0a1f44ac4d | ||
|
|
d048f23ff8 | ||
|
|
f5f8255a37 | ||
|
|
cc4d91fcb3 | ||
|
|
b296cabd35 | ||
|
|
b8a66efbba | ||
|
|
89c76a682e | ||
|
|
c5a752c7da | ||
|
|
f3a80ab7c5 | ||
|
|
014a7c92af | ||
|
|
4bfbb8b9dd | ||
|
|
e0d1364e45 | ||
|
|
bb73598c4c | ||
|
|
76fea94965 | ||
|
|
75e16b40d0 | ||
|
|
adfa76981d | ||
|
|
e7e4bbdd57 | ||
|
|
6ce0e38951 | ||
|
|
bcb6c5f69a | ||
|
|
0ddc86ee88 | ||
|
|
ffe4529018 | ||
|
|
685dc33a56 | ||
|
|
3da993e2df |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
package-lock.json -diff -merge
|
||||
package-lock.json linguist-generated=true
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -6,16 +6,18 @@ node_modules/
|
||||
/.awcache
|
||||
/.vscode
|
||||
|
||||
# bundle
|
||||
packages/**/*.d.ts
|
||||
packages/**/*.js
|
||||
|
||||
# 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
|
||||
/src/microservices/npm-debug.log
|
||||
/src/websockets/npm-debug.log
|
||||
/**/npm-debug.log
|
||||
/packages/**/.npmignore
|
||||
/packages/**/LICENSE
|
||||
|
||||
# example
|
||||
/quick-start
|
||||
|
||||
13
.npmignore
Normal file
13
.npmignore
Normal file
@@ -0,0 +1,13 @@
|
||||
# source
|
||||
**/*.ts
|
||||
*.ts
|
||||
|
||||
# definitions
|
||||
!**/*.d.ts
|
||||
!*.d.ts
|
||||
|
||||
# configuration
|
||||
package-lock.json
|
||||
tslint.json
|
||||
tsconfig.json
|
||||
.prettierrc
|
||||
@@ -1 +1,2 @@
|
||||
/bundle
|
||||
packages/**/*.d.ts
|
||||
packages/**/*.js
|
||||
@@ -17,7 +17,8 @@ before_install:
|
||||
- npm i -g npm@latest
|
||||
install:
|
||||
- npm ci
|
||||
- gulp build
|
||||
- npm run build:dev
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
after_success: npm run coverage
|
||||
165
CONTRIBUTING.md
165
CONTRIBUTING.md
@@ -3,14 +3,15 @@
|
||||
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) -->
|
||||
* [Code of Conduct](#coc)
|
||||
* [Question or Problem?](#question)
|
||||
* [Issues and Bugs](#issue)
|
||||
* [Feature Requests](#feature)
|
||||
* [Submission Guidelines](#submit)
|
||||
* [Development Setup](#development)
|
||||
* [Coding Rules](#rules)
|
||||
* [Commit Message Guidelines](#commit)
|
||||
<!-- - [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]. -->
|
||||
@@ -22,27 +23,30 @@ Help us keep Nest open and inclusive. Please read and follow our [Code of Conduc
|
||||
Stack Overflow is a much better place to ask questions since:
|
||||
|
||||
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
|
||||
- questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
- Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
|
||||
* questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
* Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
|
||||
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
|
||||
|
||||
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
|
||||
|
||||
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".
|
||||
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
|
||||
@@ -53,9 +57,9 @@ Before you submit an issue, please search the issue tracker, maybe an issue for
|
||||
|
||||
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
|
||||
|
||||
- version of NestJS used
|
||||
- 3rd-party libraries and their versions
|
||||
- and most importantly - a use-case that fails
|
||||
* version of NestJS used
|
||||
* 3rd-party libraries and their versions
|
||||
* and most importantly - a use-case that fails
|
||||
|
||||
<!--
|
||||
// TODO we need to create a playground, similar to plunkr
|
||||
@@ -68,42 +72,45 @@ Unfortunately, we are not able to investigate / fix bugs without a minimal repro
|
||||
|
||||
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.
|
||||
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
|
||||
```
|
||||
```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.
|
||||
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.
|
||||
[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.
|
||||
```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
|
||||
```
|
||||
```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):
|
||||
@@ -122,33 +129,74 @@ 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
|
||||
```
|
||||
```shell
|
||||
git push origin --delete my-fix-branch
|
||||
```
|
||||
|
||||
* Check out the master branch:
|
||||
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
|
||||
* Delete the local branch:
|
||||
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
|
||||
* Update your master with the latest upstream version:
|
||||
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
|
||||
## <a name="development"></a> Development Setup
|
||||
|
||||
You will need Node.js version 8.9.0+.
|
||||
|
||||
1. After cloning the repo, run:
|
||||
|
||||
```bash
|
||||
$ npm i # (or yarn install)
|
||||
```
|
||||
|
||||
2. In order to prepare your environment run `prepare.sh` shell script:
|
||||
|
||||
```bash
|
||||
$ sh scripts/prepare.sh
|
||||
```
|
||||
|
||||
That will compile fresh packages and afterward, move them to all `sample` directories as well as integration tests.
|
||||
|
||||
### Commonly used NPM scripts
|
||||
|
||||
```bash
|
||||
# build all packages and put them near to their source .ts files
|
||||
$ npm run build
|
||||
|
||||
# build all packages and move to "sample" and "integration" directories
|
||||
# if cross-packages breaking changes were performed you may face irrelevant errors
|
||||
# in order to verify the build, you can run this command again then
|
||||
$ npm run build:dev
|
||||
|
||||
# run the full unit tests suite
|
||||
$ npm run test
|
||||
|
||||
# run integration tests
|
||||
# docker is required(!)
|
||||
$ sh scripts/run-integration.sh
|
||||
|
||||
# run linter
|
||||
$ npm run lint
|
||||
```
|
||||
|
||||
## <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
|
||||
@@ -157,12 +205,13 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
|
||||
|
||||
## <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 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
|
||||
|
||||
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**:
|
||||
|
||||
```
|
||||
@@ -184,17 +233,15 @@ Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
|
||||
|
||||
```
|
||||
docs(changelog) update change log to beta.5
|
||||
```
|
||||
```
|
||||
bugfix(core) need to depend on latest rxjs and zone.js
|
||||
|
||||
The version in our package.json gets copied to the one we publish, and users need the latest of these.
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
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)
|
||||
@@ -208,6 +255,7 @@ Must be one of the following:
|
||||
* **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:
|
||||
@@ -224,10 +272,11 @@ 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 -->
|
||||
<!-- * **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"
|
||||
@@ -235,10 +284,12 @@ The subject contains succinct description of the change:
|
||||
* 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**.
|
||||
|
||||
@@ -255,9 +306,10 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
|
||||
* 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
|
||||
@@ -268,4 +320,5 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
|
||||
[jsfiddle]: http://jsfiddle.net
|
||||
[plunker]: http://plnkr.co/edit
|
||||
[runnable]: http://runnable.com
|
||||
|
||||
<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->
|
||||
|
||||
@@ -58,7 +58,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
#### 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>
|
||||
<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> <a href="https://genuinebee.com/"><img src="https://nestjs.com/img/genuinebee.svg" height="38" /></a> <a href="http://architectnow.net/"><img src="https://nestjs.com/img/architectnow.png" height="24" /></a> <a href="https://quander.io/"><img src="https://nestjs.com/img/quander.png" height="28" /></a>
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
48
benchmarks/all_output.txt
Normal file
48
benchmarks/all_output.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
-----------------------
|
||||
express
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
8 threads and 1024 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 47.78ms 19.09ms 212.47ms 66.94%
|
||||
Req/Sec 1.31k 268.90 2.07k 72.38%
|
||||
104687 requests in 10.02s, 21.47MB read
|
||||
Socket errors: connect 0, read 877, write 0, timeout 0
|
||||
Requests/sec: 10444.24
|
||||
Transfer/sec: 2.14MB
|
||||
-----------------------
|
||||
fastify
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
8 threads and 1024 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 21.80ms 8.73ms 78.12ms 55.78%
|
||||
Req/Sec 2.99k 0.92k 5.67k 68.88%
|
||||
238550 requests in 10.02s, 31.17MB read
|
||||
Socket errors: connect 0, read 862, write 0, timeout 0
|
||||
Requests/sec: 23795.79
|
||||
Transfer/sec: 3.11MB
|
||||
-----------------------
|
||||
nest
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
8 threads and 1024 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 54.00ms 22.33ms 200.25ms 62.23%
|
||||
Req/Sec 1.15k 338.60 1.88k 66.12%
|
||||
91348 requests in 10.05s, 18.82MB read
|
||||
Socket errors: connect 0, read 983, write 0, timeout 0
|
||||
Requests/sec: 9093.64
|
||||
Transfer/sec: 1.87MB
|
||||
-----------------------
|
||||
nest-fastify
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
8 threads and 1024 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 29.31ms 11.71ms 101.96ms 70.03%
|
||||
Req/Sec 2.17k 0.93k 4.12k 63.13%
|
||||
173241 requests in 10.05s, 22.80MB read
|
||||
Socket errors: connect 0, read 934, write 0, timeout 0
|
||||
Requests/sec: 17233.87
|
||||
Transfer/sec: 2.27MB
|
||||
7
benchmarks/express.js
Normal file
7
benchmarks/express.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
app.get('/', async (req, res) => res.send('Hello world'));
|
||||
app.listen(3000);
|
||||
5
benchmarks/fastify.js
Normal file
5
benchmarks/fastify.js
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const fastify = require('fastify')();
|
||||
fastify.get('/', async (req, reply) => reply.send('Hello world'));
|
||||
fastify.listen(3000);
|
||||
9
benchmarks/nest-fastify.js
Normal file
9
benchmarks/nest-fastify.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const core_1 = require('@nestjs/core');
|
||||
const app_module_1 = require('./nest/app.module');
|
||||
core_1.NestFactory.create(app_module_1.AppModule, new core_1.FastifyAdapter(), {
|
||||
logger: false,
|
||||
bodyParser: false,
|
||||
}).then(app => app.listen(3000));
|
||||
//# sourceMappingURL=main.js.map
|
||||
9
benchmarks/nest.js
Normal file
9
benchmarks/nest.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const core_1 = require('@nestjs/core');
|
||||
const app_module_1 = require('./nest/app.module');
|
||||
core_1.NestFactory.create(app_module_1.AppModule, {
|
||||
logger: false,
|
||||
bodyParser: false,
|
||||
}).then(app => app.listen(3000));
|
||||
//# sourceMappingURL=main.js.map
|
||||
3
benchmarks/nest/app.controller.d.ts
vendored
Normal file
3
benchmarks/nest/app.controller.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare class AppController {
|
||||
root(): string;
|
||||
}
|
||||
28
benchmarks/nest/app.controller.js
Normal file
28
benchmarks/nest/app.controller.js
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const common_1 = require("@nestjs/common");
|
||||
let AppController = class AppController {
|
||||
root() {
|
||||
return 'Hello world!';
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
common_1.Get(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", String)
|
||||
], AppController.prototype, "root", null);
|
||||
AppController = __decorate([
|
||||
common_1.Controller()
|
||||
], AppController);
|
||||
exports.AppController = AppController;
|
||||
//# sourceMappingURL=app.controller.js.map
|
||||
1
benchmarks/nest/app.controller.js.map
Normal file
1
benchmarks/nest/app.controller.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAiD;AAGjD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAExB,IAAI;QACF,OAAO,cAAc,CAAA;IACvB,CAAC;CACF,CAAA;AAHC;IADC,YAAG,EAAE;;;;yCAGL;AAJU,aAAa;IADzB,mBAAU,EAAE;GACA,aAAa,CAKzB;AALY,sCAAa"}
|
||||
1
benchmarks/nest/app.module.d.ts
vendored
Normal file
1
benchmarks/nest/app.module.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare class AppModule {}
|
||||
@@ -6,20 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const bad_request_exception_1 = require("../exceptions/bad-request.exception");
|
||||
const index_1 = require("../index");
|
||||
let ParseIntPipe = class ParseIntPipe {
|
||||
async transform(value, metadata) {
|
||||
const isNumeric = 'string' === typeof value &&
|
||||
!isNaN(parseFloat(value)) &&
|
||||
isFinite(value);
|
||||
if (!isNumeric) {
|
||||
throw new bad_request_exception_1.BadRequestException('Validation failed (numeric string is expected)');
|
||||
}
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
const common_1 = require("@nestjs/common");
|
||||
const app_controller_1 = require("./app.controller");
|
||||
let AppModule = class AppModule {
|
||||
};
|
||||
ParseIntPipe = __decorate([
|
||||
index_1.Injectable()
|
||||
], ParseIntPipe);
|
||||
exports.ParseIntPipe = ParseIntPipe;
|
||||
AppModule = __decorate([
|
||||
common_1.Module({
|
||||
imports: [],
|
||||
controllers: [app_controller_1.AppController],
|
||||
})
|
||||
], AppModule);
|
||||
exports.AppModule = AppModule;
|
||||
//# sourceMappingURL=app.module.js.map
|
||||
1
benchmarks/nest/app.module.js.map
Normal file
1
benchmarks/nest/app.module.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAMjD,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAJrB,eAAM,CAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;KAC7B,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}
|
||||
1
benchmarks/nest/main.js.map
Normal file
1
benchmarks/nest/main.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}
|
||||
14
benchmarks/run.sh
Normal file
14
benchmarks/run.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo 'Library:' $1
|
||||
node $1 &
|
||||
pid=$!
|
||||
|
||||
sleep 2
|
||||
|
||||
wrk 'http://localhost:3000' \
|
||||
-d 10 \
|
||||
-c 1024 \
|
||||
-t 8
|
||||
|
||||
kill $pid
|
||||
23
benchmarks/run_all.sh
Normal file
23
benchmarks/run_all.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
: > all_output.txt
|
||||
|
||||
lib=(express fastify nest nest-fastify)
|
||||
for item in ${lib[*]}
|
||||
do
|
||||
echo '-----------------------' >> all_output.txt
|
||||
echo $item >> all_output.txt
|
||||
echo '-----------------------' >> all_output.txt
|
||||
|
||||
node $item &
|
||||
pid=$!
|
||||
|
||||
sleep 2
|
||||
|
||||
wrk 'http://localhost:3000' \
|
||||
-d 10 \
|
||||
-c 1024 \
|
||||
-t 8 >> all_output.txt
|
||||
|
||||
kill $pid
|
||||
done
|
||||
3
bundle/common/cache/cache.constants.d.ts
vendored
3
bundle/common/cache/cache.constants.d.ts
vendored
@@ -1,3 +0,0 @@
|
||||
export declare const CACHE_MANAGER = "CACHE_MANAGER";
|
||||
export declare const CACHE_MODULE_OPTIONS = "CACHE_MODULE_OPTIONS";
|
||||
export declare const CACHE_KEY_METADATA = "cache_module:cache_key";
|
||||
5
bundle/common/cache/cache.constants.js
vendored
5
bundle/common/cache/cache.constants.js
vendored
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CACHE_MANAGER = 'CACHE_MANAGER';
|
||||
exports.CACHE_MODULE_OPTIONS = 'CACHE_MODULE_OPTIONS';
|
||||
exports.CACHE_KEY_METADATA = 'cache_module:cache_key';
|
||||
8
bundle/common/cache/cache.module.d.ts
vendored
8
bundle/common/cache/cache.module.d.ts
vendored
@@ -1,8 +0,0 @@
|
||||
import { DynamicModule } from '../interfaces';
|
||||
import { CacheModuleAsyncOptions, CacheModuleOptions } from './interfaces/cache-module.interface';
|
||||
export declare class CacheModule {
|
||||
static register(options?: CacheModuleOptions): DynamicModule;
|
||||
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule;
|
||||
private static createAsyncProviders(options);
|
||||
private static createAsyncOptionsProvider(options);
|
||||
}
|
||||
60
bundle/common/cache/cache.module.js
vendored
60
bundle/common/cache/cache.module.js
vendored
@@ -1,60 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decorators_1 = require("../decorators");
|
||||
const cache_constants_1 = require("./cache.constants");
|
||||
const cache_providers_1 = require("./cache.providers");
|
||||
let CacheModule = CacheModule_1 = class CacheModule {
|
||||
static register(options = {}) {
|
||||
return {
|
||||
module: CacheModule_1,
|
||||
providers: [{ provide: cache_constants_1.CACHE_MODULE_OPTIONS, useValue: options }],
|
||||
};
|
||||
}
|
||||
static registerAsync(options) {
|
||||
return {
|
||||
module: CacheModule_1,
|
||||
imports: options.imports,
|
||||
providers: this.createAsyncProviders(options),
|
||||
};
|
||||
}
|
||||
static createAsyncProviders(options) {
|
||||
if (options.useExisting || options.useFactory) {
|
||||
return [this.createAsyncOptionsProvider(options)];
|
||||
}
|
||||
return [
|
||||
this.createAsyncOptionsProvider(options),
|
||||
{
|
||||
provide: options.useClass,
|
||||
useClass: options.useClass,
|
||||
},
|
||||
];
|
||||
}
|
||||
static createAsyncOptionsProvider(options) {
|
||||
if (options.useFactory) {
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
|
||||
useFactory: options.useFactory,
|
||||
inject: options.inject || [],
|
||||
};
|
||||
}
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
|
||||
useFactory: async (optionsFactory) => await optionsFactory.createCacheOptions(),
|
||||
inject: [options.useExisting || options.useClass],
|
||||
};
|
||||
}
|
||||
};
|
||||
CacheModule = CacheModule_1 = __decorate([
|
||||
decorators_1.Module({
|
||||
providers: [cache_providers_1.createCacheManager()],
|
||||
exports: [cache_constants_1.CACHE_MANAGER],
|
||||
})
|
||||
], CacheModule);
|
||||
exports.CacheModule = CacheModule;
|
||||
var CacheModule_1;
|
||||
2
bundle/common/cache/cache.providers.d.ts
vendored
2
bundle/common/cache/cache.providers.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
import { Provider } from '../interfaces';
|
||||
export declare function createCacheManager(): Provider;
|
||||
17
bundle/common/cache/cache.providers.js
vendored
17
bundle/common/cache/cache.providers.js
vendored
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const load_package_util_1 = require("../utils/load-package.util");
|
||||
const cache_constants_1 = require("./cache.constants");
|
||||
const default_options_1 = require("./default-options");
|
||||
function createCacheManager() {
|
||||
return {
|
||||
provide: cache_constants_1.CACHE_MANAGER,
|
||||
useFactory: (options) => {
|
||||
const cacheManager = load_package_util_1.loadPackage('cache-manager', 'CacheModule');
|
||||
const memoryCache = cacheManager.caching(Object.assign({}, default_options_1.defaultCacheOptions, (options || {})));
|
||||
return memoryCache;
|
||||
},
|
||||
inject: [cache_constants_1.CACHE_MODULE_OPTIONS],
|
||||
};
|
||||
}
|
||||
exports.createCacheManager = createCacheManager;
|
||||
@@ -1 +0,0 @@
|
||||
export declare const CacheKey: (key: string) => (target: object, key?: any, descriptor?: any) => any;
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const decorators_1 = require("../../decorators");
|
||||
const cache_constants_1 = require("../cache.constants");
|
||||
exports.CacheKey = (key) => decorators_1.ReflectMetadata(cache_constants_1.CACHE_KEY_METADATA, key);
|
||||
1
bundle/common/cache/decorators/index.d.ts
vendored
1
bundle/common/cache/decorators/index.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export * from './cache-key.decorator';
|
||||
6
bundle/common/cache/decorators/index.js
vendored
6
bundle/common/cache/decorators/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./cache-key.decorator"));
|
||||
5
bundle/common/cache/default-options.d.ts
vendored
5
bundle/common/cache/default-options.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
export declare const defaultCacheOptions: {
|
||||
ttl: number;
|
||||
max: number;
|
||||
store: string;
|
||||
};
|
||||
7
bundle/common/cache/default-options.js
vendored
7
bundle/common/cache/default-options.js
vendored
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultCacheOptions = {
|
||||
ttl: 5,
|
||||
max: 100,
|
||||
store: 'memory',
|
||||
};
|
||||
4
bundle/common/cache/index.d.ts
vendored
4
bundle/common/cache/index.d.ts
vendored
@@ -1,4 +0,0 @@
|
||||
export * from './cache.module';
|
||||
export * from './decorators';
|
||||
export * from './interceptors';
|
||||
export * from './interfaces';
|
||||
8
bundle/common/cache/index.js
vendored
8
bundle/common/cache/index.js
vendored
@@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./cache.module"));
|
||||
__export(require("./decorators"));
|
||||
__export(require("./interceptors"));
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExecutionContext, HttpServer, NestInterceptor } from '../../interfaces';
|
||||
export declare class CacheInterceptor implements NestInterceptor {
|
||||
protected readonly httpServer: HttpServer;
|
||||
protected readonly cacheManager: any;
|
||||
protected readonly reflector: any;
|
||||
protected readonly isHttpApp: boolean;
|
||||
constructor(httpServer: HttpServer, cacheManager: any, reflector: any);
|
||||
intercept(context: ExecutionContext, call$: Observable<any>): Promise<Observable<any>>;
|
||||
getCacheKey(context: ExecutionContext): string | undefined;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const decorators_1 = require("../../decorators");
|
||||
const cache_constants_1 = require("../cache.constants");
|
||||
// NOTE (external)
|
||||
// We need to deduplicate them here due to the circular dependency
|
||||
// between core and common packages
|
||||
const HTTP_SERVER_REF = 'HTTP_SERVER_REF';
|
||||
const REFLECTOR = 'Reflector';
|
||||
let CacheInterceptor = class CacheInterceptor {
|
||||
constructor(httpServer, cacheManager, reflector) {
|
||||
this.httpServer = httpServer;
|
||||
this.cacheManager = cacheManager;
|
||||
this.reflector = reflector;
|
||||
this.isHttpApp = httpServer && !!httpServer.getRequestMethod;
|
||||
}
|
||||
async intercept(context, call$) {
|
||||
const key = this.getCacheKey(context);
|
||||
if (!key) {
|
||||
return call$;
|
||||
}
|
||||
try {
|
||||
const value = await this.cacheManager.get(key);
|
||||
if (value) {
|
||||
return rxjs_1.of(value);
|
||||
}
|
||||
return call$.pipe(operators_1.tap(response => this.cacheManager.set(key, response)));
|
||||
}
|
||||
catch (_a) {
|
||||
return call$;
|
||||
}
|
||||
}
|
||||
getCacheKey(context) {
|
||||
if (!this.isHttpApp) {
|
||||
return this.reflector.get(cache_constants_1.CACHE_KEY_METADATA, context.getHandler());
|
||||
}
|
||||
const request = context.getArgByIndex(0);
|
||||
if (this.httpServer.getRequestMethod(request) !== 'GET') {
|
||||
return undefined;
|
||||
}
|
||||
return this.httpServer.getRequestUrl(context.getArgByIndex(0));
|
||||
}
|
||||
};
|
||||
CacheInterceptor = __decorate([
|
||||
decorators_1.Injectable(),
|
||||
__param(0, decorators_1.Optional()),
|
||||
__param(0, decorators_1.Inject(HTTP_SERVER_REF)),
|
||||
__param(1, decorators_1.Inject(cache_constants_1.CACHE_MANAGER)),
|
||||
__param(2, decorators_1.Inject(REFLECTOR)),
|
||||
__metadata("design:paramtypes", [Object, Object, Object])
|
||||
], CacheInterceptor);
|
||||
exports.CacheInterceptor = CacheInterceptor;
|
||||
1
bundle/common/cache/interceptors/index.d.ts
vendored
1
bundle/common/cache/interceptors/index.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export * from './cache.interceptor';
|
||||
6
bundle/common/cache/interceptors/index.js
vendored
6
bundle/common/cache/interceptors/index.js
vendored
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./cache.interceptor"));
|
||||
@@ -1,17 +0,0 @@
|
||||
export interface LiteralObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface CacheStore {
|
||||
set<T>(key: string, value: T): Promise<void> | void;
|
||||
get<T>(key: string): Promise<void> | void;
|
||||
del(key: string): void | Promise<void>;
|
||||
}
|
||||
export interface CacheStoreFactory {
|
||||
create(args: LiteralObject): CacheStore;
|
||||
}
|
||||
export interface CacheManagerOptions {
|
||||
store?: string | CacheStoreFactory;
|
||||
ttl?: number;
|
||||
max?: number;
|
||||
isCacheableValue?: (value: any) => boolean;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,14 +0,0 @@
|
||||
import { ModuleMetadata, Type } from './../../interfaces';
|
||||
import { CacheManagerOptions } from './cache-manager.interface';
|
||||
export interface CacheModuleOptions extends CacheManagerOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface CacheOptionsFactory {
|
||||
createCacheOptions(): Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
}
|
||||
export interface CacheModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
||||
useExisting?: Type<CacheOptionsFactory>;
|
||||
useClass?: Type<CacheOptionsFactory>;
|
||||
useFactory?: (...args: any[]) => Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
inject?: any[];
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
bundle/common/cache/interfaces/index.d.ts
vendored
2
bundle/common/cache/interfaces/index.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export * from './cache-manager.interface';
|
||||
export * from './cache-module.interface';
|
||||
2
bundle/common/cache/interfaces/index.js
vendored
2
bundle/common/cache/interfaces/index.js
vendored
@@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
28
bundle/common/constants.d.ts
vendored
28
bundle/common/constants.d.ts
vendored
@@ -1,28 +0,0 @@
|
||||
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__";
|
||||
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 = "__gatewayMiddleware";
|
||||
export declare const MODULE_PATH = "__module_path__";
|
||||
export declare const HEADERS_METADATA = "__headers__";
|
||||
export declare const REDIRECT_METADATA = "__redirect__";
|
||||
@@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
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__';
|
||||
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 = '__gatewayMiddleware';
|
||||
exports.MODULE_PATH = '__module_path__';
|
||||
exports.HEADERS_METADATA = '__headers__';
|
||||
exports.REDIRECT_METADATA = '__redirect__';
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
export declare function Bind(...decorators: any[]): (target: object, key: any, descriptor: any) => any;
|
||||
@@ -1,14 +0,0 @@
|
||||
"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;
|
||||
@@ -1,7 +0,0 @@
|
||||
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;
|
||||
@@ -1,14 +0,0 @@
|
||||
"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;
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const uuid = require("uuid/v4");
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Injectable() {
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Component() {
|
||||
deprecate('The @Component() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Component = Component;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
function Pipe() {
|
||||
deprecate('The @Pipe() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Pipe = Pipe;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
function Guard() {
|
||||
deprecate('The @Guard() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Guard = Guard;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
function Middleware() {
|
||||
deprecate('The @Middleware() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Middleware = Middleware;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
function Interceptor() {
|
||||
deprecate('The @Interceptor() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Interceptor = Interceptor;
|
||||
function mixin(mixinClass) {
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: uuid(),
|
||||
});
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
@@ -1,6 +0,0 @@
|
||||
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;
|
||||
@@ -1,16 +0,0 @@
|
||||
"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;
|
||||
@@ -1,3 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
@@ -1,15 +0,0 @@
|
||||
"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);
|
||||
};
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
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;
|
||||
@@ -1,31 +0,0 @@
|
||||
"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
12
bundle/common/decorators/core/index.d.ts
vendored
@@ -1,12 +0,0 @@
|
||||
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';
|
||||
@@ -1,17 +0,0 @@
|
||||
"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"));
|
||||
@@ -1,6 +0,0 @@
|
||||
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;
|
||||
@@ -1,18 +0,0 @@
|
||||
"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;
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
*/
|
||||
export declare function Optional(): ParameterDecorator;
|
||||
@@ -1,14 +0,0 @@
|
||||
"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;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* 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,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Assigns the metadata to the class/function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
exports.ReflectMetadata = (metadataKey, metadataValue) => (target, key, descriptor) => {
|
||||
if (descriptor) {
|
||||
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
Reflect.defineMetadata(metadataKey, metadataValue, target);
|
||||
return target;
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
@@ -1,30 +0,0 @@
|
||||
"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;
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
@@ -1,31 +0,0 @@
|
||||
"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;
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
@@ -1,29 +0,0 @@
|
||||
"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;
|
||||
@@ -1,15 +0,0 @@
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
export declare type ParamDecoratorEnhancer = ParameterDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | any)[]) => ParameterDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;
|
||||
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const uuid = require("uuid/v4");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
|
||||
index,
|
||||
factory,
|
||||
data,
|
||||
pipes,
|
||||
} }));
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory, enhancers = []) {
|
||||
const paramtype = uuid();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const isPipe = pipe => pipe &&
|
||||
((shared_utils_1.isFunction(pipe) && pipe.prototype) || shared_utils_1.isFunction(pipe.transform));
|
||||
const hasParamData = shared_utils_1.isNil(data) || !isPipe(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
|
||||
enhancers.forEach(fn => fn(target, key, index));
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
function createRouteParamDecorator(factory) {
|
||||
deprecate('The "createRouteParamDecorator" function is deprecated and will be removed within next major release. Use "createParamDecorator" instead.');
|
||||
return createParamDecorator(factory);
|
||||
}
|
||||
exports.createRouteParamDecorator = createRouteParamDecorator;
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
export declare function Header(name: string, value: string): MethodDecorator;
|
||||
@@ -1,15 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
function Header(name, value) {
|
||||
return (target, key, descriptor) => {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Header = Header;
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
@@ -1,16 +0,0 @@
|
||||
"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
6
bundle/common/decorators/http/index.d.ts
vendored
@@ -1,6 +0,0 @@
|
||||
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';
|
||||
@@ -1,11 +0,0 @@
|
||||
"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"));
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
export declare function Redirect(url: string): MethodDecorator;
|
||||
@@ -1,14 +0,0 @@
|
||||
"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;
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
export declare function Render(template: string): MethodDecorator;
|
||||
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
function Render(template) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Render = Render;
|
||||
@@ -1,35 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
import { RequestMappingMetadata } from '../../interfaces/request-mapping-metadata.interface';
|
||||
export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
*/
|
||||
export declare const Post: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP GET requests to the specified path.
|
||||
*/
|
||||
export declare const Get: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP DELETE requests to the specified path.
|
||||
*/
|
||||
export declare const Delete: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP PUT requests to the specified path.
|
||||
*/
|
||||
export declare const Put: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP PATCH requests to the specified path.
|
||||
*/
|
||||
export declare const Patch: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP OPTIONS requests to the specified path.
|
||||
*/
|
||||
export declare const Options: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP HEAD requests to the specified path.
|
||||
*/
|
||||
export declare const Head: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes all HTTP requests to the specified path.
|
||||
*/
|
||||
export declare const All: (path?: string) => MethodDecorator;
|
||||
@@ -1,56 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const request_method_enum_1 = require("../../enums/request-method.enum");
|
||||
const constants_1 = require("../../constants");
|
||||
const defaultMetadata = {
|
||||
[constants_1.PATH_METADATA]: '/',
|
||||
[constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET,
|
||||
};
|
||||
exports.RequestMapping = (metadata = defaultMetadata) => {
|
||||
const path = metadata[constants_1.PATH_METADATA] || '/';
|
||||
const requestMethod = metadata[constants_1.METHOD_METADATA] || request_method_enum_1.RequestMethod.GET;
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
|
||||
Reflect.defineMetadata(constants_1.METHOD_METADATA, requestMethod, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
};
|
||||
const createMappingDecorator = (method) => (path) => {
|
||||
return exports.RequestMapping({
|
||||
[constants_1.PATH_METADATA]: path,
|
||||
[constants_1.METHOD_METADATA]: method,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
*/
|
||||
exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST);
|
||||
/**
|
||||
* Routes HTTP GET requests to the specified path.
|
||||
*/
|
||||
exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET);
|
||||
/**
|
||||
* Routes HTTP DELETE requests to the specified path.
|
||||
*/
|
||||
exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELETE);
|
||||
/**
|
||||
* Routes HTTP PUT requests to the specified path.
|
||||
*/
|
||||
exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT);
|
||||
/**
|
||||
* Routes HTTP PATCH requests to the specified path.
|
||||
*/
|
||||
exports.Patch = createMappingDecorator(request_method_enum_1.RequestMethod.PATCH);
|
||||
/**
|
||||
* Routes HTTP OPTIONS requests to the specified path.
|
||||
*/
|
||||
exports.Options = createMappingDecorator(request_method_enum_1.RequestMethod.OPTIONS);
|
||||
/**
|
||||
* Routes HTTP HEAD requests to the specified path.
|
||||
*/
|
||||
exports.Head = createMappingDecorator(request_method_enum_1.RequestMethod.HEAD);
|
||||
/**
|
||||
* Routes all HTTP requests to the specified path.
|
||||
*/
|
||||
exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
|
||||
@@ -1,28 +0,0 @@
|
||||
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;
|
||||
@@ -1,45 +0,0 @@
|
||||
"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
3
bundle/common/decorators/index.d.ts
vendored
@@ -1,3 +0,0 @@
|
||||
export * from './core';
|
||||
export * from './modules';
|
||||
export * from './http';
|
||||
@@ -1,8 +0,0 @@
|
||||
"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"));
|
||||
@@ -1 +0,0 @@
|
||||
export declare const InvalidModuleConfigMessage: (property: string) => string;
|
||||
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.InvalidModuleConfigMessage = (property) => `Invalid property '${property}' in @Module() decorator.`;
|
||||
@@ -1,3 +0,0 @@
|
||||
export declare class InvalidModuleConfigException extends Error {
|
||||
constructor(property: string);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("./constants");
|
||||
class InvalidModuleConfigException extends Error {
|
||||
constructor(property) {
|
||||
super(constants_1.InvalidModuleConfigMessage(property));
|
||||
}
|
||||
}
|
||||
exports.InvalidModuleConfigException = InvalidModuleConfigException;
|
||||
@@ -1,6 +0,0 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
export declare function Global(): ClassDecorator;
|
||||
@@ -1,14 +0,0 @@
|
||||
"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
3
bundle/common/decorators/modules/index.d.ts
vendored
@@ -1,3 +0,0 @@
|
||||
export * from './module.decorator';
|
||||
export * from './single-scope.decorator';
|
||||
export * from './global.decorator';
|
||||
@@ -1,8 +0,0 @@
|
||||
"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"));
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user