mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 23:41:40 +00:00
Compare commits
195 Commits
BrunnerLiv
...
v6.6.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
432dc3bad5 | ||
|
|
d4bb43009b | ||
|
|
fbe80927b3 | ||
|
|
3086df5a50 | ||
|
|
8a6476a008 | ||
|
|
8cac746b2c | ||
|
|
f8088a0119 | ||
|
|
d36d2f5e2d | ||
|
|
6b7e5c2918 | ||
|
|
a8160cfa38 | ||
|
|
3bd6d4de9b | ||
|
|
77fb3bae6b | ||
|
|
d77cdef120 | ||
|
|
9af2f6eb0f | ||
|
|
c575f9dfd7 | ||
|
|
af0d322fcf | ||
|
|
935399f146 | ||
|
|
d469f1823b | ||
|
|
12368ffca7 | ||
|
|
ce912dac83 | ||
|
|
0094b29283 | ||
|
|
580eaab106 | ||
|
|
b9d6508ead | ||
|
|
efeb072797 | ||
|
|
64907e5879 | ||
|
|
915fa708f0 | ||
|
|
565a5a8a11 | ||
|
|
d357f1edfe | ||
|
|
3148e0f866 | ||
|
|
5f3eeff77a | ||
|
|
17d29a952c | ||
|
|
2bbff5432e | ||
|
|
d77936b7bd | ||
|
|
f48d4d422d | ||
|
|
9874b55b27 | ||
|
|
74fb7917ce | ||
|
|
f9ec473f64 | ||
|
|
ad2fecfef8 | ||
|
|
1e9930aa6c | ||
|
|
7c13c100e2 | ||
|
|
63ac6c098f | ||
|
|
a7c24a168e | ||
|
|
f690baf387 | ||
|
|
908438c98f | ||
|
|
4cf0e7bfab | ||
|
|
707ff6e512 | ||
|
|
37488d4d1e | ||
|
|
db61bc1729 | ||
|
|
c0fc683b7c | ||
|
|
84acc114cf | ||
|
|
69dcf81f54 | ||
|
|
de4a990aae | ||
|
|
af54516b99 | ||
|
|
3c59864847 | ||
|
|
741f55046f | ||
|
|
1cf7610e9b | ||
|
|
bbb8000831 | ||
|
|
f0d0ded2d7 | ||
|
|
02c8b5b2b9 | ||
|
|
f1ab1f1ab0 | ||
|
|
a023c5871e | ||
|
|
4cea99e16f | ||
|
|
f791b3e6b1 | ||
|
|
1a0102b007 | ||
|
|
7516de13a8 | ||
|
|
2cdebc888d | ||
|
|
557f585a00 | ||
|
|
892df6c433 | ||
|
|
83e846633b | ||
|
|
709625e273 | ||
|
|
cb4eb3d7ad | ||
|
|
1490a8a8b3 | ||
|
|
1b166131d7 | ||
|
|
37e41d7afe | ||
|
|
40234488d6 | ||
|
|
781bf4d283 | ||
|
|
c80834894a | ||
|
|
16ae1407e1 | ||
|
|
2e05368b2e | ||
|
|
a68ae579d4 | ||
|
|
aa9dfbb7ba | ||
|
|
8278746279 | ||
|
|
60eae53f98 | ||
|
|
77298e804a | ||
|
|
9a53587afa | ||
|
|
7cfffb9a95 | ||
|
|
0e2a4e7e84 | ||
|
|
25174cbef4 | ||
|
|
8d9b996b2f | ||
|
|
27c1c0881e | ||
|
|
d01a798d7b | ||
|
|
b8fbda24bd | ||
|
|
464c2bbef0 | ||
|
|
a9aaf86099 | ||
|
|
85f3897ae1 | ||
|
|
bed7ef1593 | ||
|
|
10c9d66cc4 | ||
|
|
6c035060a1 | ||
|
|
5ab5ed8736 | ||
|
|
1682181b78 | ||
|
|
16fdcd3a4f | ||
|
|
47ee1d68d5 | ||
|
|
acff437542 | ||
|
|
48fc6473bd | ||
|
|
09c84e2086 | ||
|
|
0a7f37d90b | ||
|
|
7f8aa92c0a | ||
|
|
9885309cd5 | ||
|
|
51bde528c0 | ||
|
|
3c340b8a41 | ||
|
|
64bc85ac28 | ||
|
|
e974283ec8 | ||
|
|
84d7178a59 | ||
|
|
844a69ee6a | ||
|
|
b4c190b912 | ||
|
|
13cdc6d23b | ||
|
|
e0fd3b8f3a | ||
|
|
ef264f1496 | ||
|
|
9d4d2abf46 | ||
|
|
036bc562ea | ||
|
|
43db50c500 | ||
|
|
5445997734 | ||
|
|
8b89187515 | ||
|
|
7af66c56fb | ||
|
|
8da95030fe | ||
|
|
63644df773 | ||
|
|
12753dafb4 | ||
|
|
de26bd490b | ||
|
|
b84246c641 | ||
|
|
458e2ccd04 | ||
|
|
a814974d6d | ||
|
|
e7a049823d | ||
|
|
a651429697 | ||
|
|
6b56bdf216 | ||
|
|
47a1434b8a | ||
|
|
ab43b862cc | ||
|
|
4f16736351 | ||
|
|
0ef817b9af | ||
|
|
b2135b43fb | ||
|
|
901191a9dd | ||
|
|
781d43d8ec | ||
|
|
a6940be500 | ||
|
|
44e62b3e7a | ||
|
|
8c9f6d75cf | ||
|
|
8d58d70e1a | ||
|
|
6a8ffcabfa | ||
|
|
ce7eecb745 | ||
|
|
aebf29e657 | ||
|
|
69e689ac7a | ||
|
|
6652b55b20 | ||
|
|
5ed092a526 | ||
|
|
945a3d7a8b | ||
|
|
34f4a84534 | ||
|
|
311265fe81 | ||
|
|
3f496afc6a | ||
|
|
e913ccf6de | ||
|
|
7d34529ece | ||
|
|
e38999e6a9 | ||
|
|
a3c47d6280 | ||
|
|
6e686bc64b | ||
|
|
1711527d4f | ||
|
|
1b96a8de7f | ||
|
|
648faecbcd | ||
|
|
86fd379ebb | ||
|
|
e23138a83e | ||
|
|
9803e4e20e | ||
|
|
36db11c989 | ||
|
|
8bccfcab4e | ||
|
|
d521792c34 | ||
|
|
98a3630819 | ||
|
|
e9d293f43d | ||
|
|
e25d97412f | ||
|
|
67a9b2830f | ||
|
|
5fdfd79eb3 | ||
|
|
4a73b92bec | ||
|
|
6c8a034784 | ||
|
|
58f93edcb4 | ||
|
|
cffe8f919f | ||
|
|
6b683eefbb | ||
|
|
e91b711456 | ||
|
|
106cdccefd | ||
|
|
9c83b26486 | ||
|
|
a165ddbccf | ||
|
|
f4d3c03d6b | ||
|
|
9d394f5668 | ||
|
|
63e5d6b806 | ||
|
|
59bdc2e4d8 | ||
|
|
1493c011ae | ||
|
|
f1271b6f1e | ||
|
|
7d9c0a1c0d | ||
|
|
abb3549f28 | ||
|
|
b9ce9b8d5f | ||
|
|
bdb0ede50d | ||
|
|
2b5f0e2ba2 | ||
|
|
fcf5042d32 |
160
.circleci/config.yml
Normal file
160
.circleci/config.yml
Normal file
@@ -0,0 +1,160 @@
|
||||
version: 2
|
||||
|
||||
aliases:
|
||||
- &restore-cache
|
||||
restore_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- &install-deps
|
||||
run:
|
||||
name: Install dependencies
|
||||
command: npm ci
|
||||
- &build-packages
|
||||
run:
|
||||
name: Build
|
||||
command: npm run build
|
||||
- &run-unit-tests
|
||||
run:
|
||||
name: Test
|
||||
command: npm run test
|
||||
|
||||
unit-tests-template: &unit-tests-template
|
||||
working_directory: ~/nest
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- *build-packages
|
||||
- *run-unit-tests
|
||||
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Update NPM version
|
||||
command: 'sudo npm install -g npm@latest'
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: npm ci
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- run:
|
||||
name: Build
|
||||
command: npm run build
|
||||
|
||||
test_node_12:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- *build-packages
|
||||
- *run-unit-tests
|
||||
- run:
|
||||
name: Collect coverage
|
||||
command: npm run coverage
|
||||
- store_artifacts:
|
||||
path: coverage
|
||||
|
||||
test_node_10:
|
||||
<<: *unit-tests-template
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
|
||||
test_node_8:
|
||||
<<: *unit-tests-template
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
|
||||
lint:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- run:
|
||||
name: Lint
|
||||
command: npm run lint
|
||||
|
||||
integration_tests:
|
||||
working_directory: ~/nest
|
||||
machine: true
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Prepare nvm
|
||||
command: |
|
||||
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
||||
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
|
||||
- run:
|
||||
name: Upgrade Node.js
|
||||
command: |
|
||||
nvm install v12
|
||||
node -v
|
||||
nvm alias default v12
|
||||
- run:
|
||||
name: Install Docker Compose
|
||||
command: |
|
||||
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
|
||||
chmod +x ~/docker-compose
|
||||
sudo mv ~/docker-compose /usr/local/bin/docker-compose
|
||||
- *install-deps
|
||||
- run:
|
||||
name: Prepare tests
|
||||
command: |
|
||||
bash ./scripts/prepare.sh
|
||||
sleep 10
|
||||
- run:
|
||||
name: List containers
|
||||
command: docker ps
|
||||
- run:
|
||||
name: Integration tests
|
||||
command: npm run integration-test
|
||||
|
||||
samples:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- run:
|
||||
name: Build all samples
|
||||
command: npm run build:samples
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-and-test:
|
||||
jobs:
|
||||
- build
|
||||
- test_node_12:
|
||||
requires:
|
||||
- build
|
||||
- test_node_10:
|
||||
requires:
|
||||
- build
|
||||
- test_node_8:
|
||||
requires:
|
||||
- build
|
||||
- lint:
|
||||
requires:
|
||||
- build
|
||||
- integration_tests:
|
||||
requires:
|
||||
- build
|
||||
- samples:
|
||||
requires:
|
||||
- build
|
||||
|
||||
56
.travis.yml
56
.travis.yml
@@ -1,56 +0,0 @@
|
||||
language: node_js
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- "node_modules"
|
||||
|
||||
git:
|
||||
depth: 5
|
||||
|
||||
before_install:
|
||||
- npm i -g npm@latest
|
||||
|
||||
install:
|
||||
- npm ci
|
||||
- npm run build:dev
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- state: "Test"
|
||||
name: "Unit Test Node v12"
|
||||
script: npm test
|
||||
node_js: 12
|
||||
after_success: npm run coverage
|
||||
|
||||
- state: "Test"
|
||||
name: "Unit Test Node v10"
|
||||
script: npm test
|
||||
node_js: 10
|
||||
|
||||
- state: "Test"
|
||||
name: "Unit Test Node v8"
|
||||
script: npm test
|
||||
node_js: 8
|
||||
|
||||
- state: "Test"
|
||||
name: "Integration Test"
|
||||
install: skip
|
||||
before_install: skip
|
||||
before_script: skip
|
||||
addons: skip
|
||||
script:
|
||||
sudo service mysql stop &&
|
||||
bash ./scripts/prepare.sh &&
|
||||
npm run integration-test
|
||||
node_js: 12
|
||||
|
||||
- stage: "Test"
|
||||
name: "Lint"
|
||||
script: npm run lint
|
||||
node_js: 12
|
||||
|
||||
- stage: "Test"
|
||||
name: "Build samples"
|
||||
script: npm run build:samples
|
||||
node_js: 12
|
||||
|
||||
105
CONTRIBUTING.md
105
CONTRIBUTING.md
@@ -4,13 +4,14 @@ We would love for you to contribute to Nest and help make it even better than it
|
||||
today! As a contributor, here are the guidelines we would like you to follow:
|
||||
|
||||
<!--* [Code of Conduct](#coc)-->
|
||||
* [Question or Problem?](#question)
|
||||
* [Issues and Bugs](#issue)
|
||||
* [Feature Requests](#feature)
|
||||
* [Submission Guidelines](#submit)
|
||||
* [Development Setup](#development)
|
||||
* [Coding Rules](#rules)
|
||||
* [Commit Message Guidelines](#commit)
|
||||
|
||||
- [Question or Problem?](#question)
|
||||
- [Issues and Bugs](#issue)
|
||||
- [Feature Requests](#feature)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Development Setup](#development)
|
||||
- [Coding Rules](#rules)
|
||||
- [Commit Message Guidelines](#commit)
|
||||
<!-- - [Signing the CLA](#cla) -->
|
||||
|
||||
<!-- ## <a name="coc"></a> Code of Conduct
|
||||
@@ -24,8 +25,8 @@ Stack Overflow is a much better place to ask questions since:
|
||||
|
||||
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
|
||||
|
||||
* questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
* Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
- questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
- Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
|
||||
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
|
||||
|
||||
@@ -44,10 +45,10 @@ Repository. If you would like to _implement_ a new feature, please submit an iss
|
||||
a proposal for your work first, to be sure that we can use it.
|
||||
Please consider what kind of change it is:
|
||||
|
||||
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
|
||||
- For a **Major Feature**, first open an issue and outline your proposal so that it can be
|
||||
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
|
||||
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
|
||||
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
|
||||
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
|
||||
|
||||
## <a name="submit"></a> Submission Guidelines
|
||||
|
||||
@@ -57,9 +58,9 @@ Before you submit an issue, please search the issue tracker, maybe an issue for
|
||||
|
||||
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
|
||||
|
||||
* version of NestJS used
|
||||
* 3rd-party libraries and their versions
|
||||
* and most importantly - a use-case that fails
|
||||
- version of NestJS used
|
||||
- 3rd-party libraries and their versions
|
||||
- and most importantly - a use-case that fails
|
||||
|
||||
<!--
|
||||
// TODO we need to create a playground, similar to plunkr
|
||||
@@ -114,11 +115,11 @@ We cannot accept code without this.
|
||||
|
||||
1. In GitHub, send a pull request to `nestjs:master`.
|
||||
|
||||
* If we suggest changes then:
|
||||
- If we suggest changes then:
|
||||
|
||||
* Make the required updates.
|
||||
* Re-run the Nest test suites to ensure tests are still passing.
|
||||
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
- Make the required updates.
|
||||
- Re-run the Nest test suites to ensure tests are still passing.
|
||||
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
|
||||
```shell
|
||||
git rebase master -i
|
||||
@@ -132,25 +133,25 @@ That's it! Thank you for your contribution!
|
||||
After your pull request is merged, you can safely delete your branch and pull the changes
|
||||
from the main (upstream) repository:
|
||||
|
||||
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
|
||||
- Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
|
||||
|
||||
```shell
|
||||
git push origin --delete my-fix-branch
|
||||
```
|
||||
|
||||
* Check out the master branch:
|
||||
- Check out the master branch:
|
||||
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
|
||||
* Delete the local branch:
|
||||
- Delete the local branch:
|
||||
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
|
||||
* Update your master with the latest upstream version:
|
||||
- Update your master with the latest upstream version:
|
||||
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
@@ -177,13 +178,8 @@ That will compile fresh packages and afterward, move them to all `sample` direct
|
||||
### <a name="common-scripts"></a>Commonly used NPM scripts
|
||||
|
||||
```bash
|
||||
# build all packages and put them near to their source .ts files
|
||||
$ npm run build
|
||||
|
||||
# build all packages and move to "sample" and "integration" directories
|
||||
# if cross-packages breaking changes were performed you may face irrelevant errors
|
||||
# in order to verify the build, you can run this command again then
|
||||
$ npm run build:dev
|
||||
$ npm run build
|
||||
|
||||
# run the full unit tests suite
|
||||
$ npm run test
|
||||
@@ -194,6 +190,9 @@ $ sh scripts/run-integration.sh
|
||||
|
||||
# run linter
|
||||
$ npm run lint
|
||||
|
||||
# build all packages and put them near to their source .ts files
|
||||
$ npm run build:prod
|
||||
```
|
||||
|
||||
## <a name="rules"></a> Coding Rules
|
||||
@@ -204,8 +203,8 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
|
||||
// We're working on auto-documentation.
|
||||
* All public API methods **must be documented**. (Details TBC). -->
|
||||
|
||||
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
|
||||
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
|
||||
- All features or bug fixes **must be tested** by one or more specs (unit-tests).
|
||||
- We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
|
||||
**100 characters**. An automated formatter is available (`npm run format`).
|
||||
|
||||
## <a name="commit"></a> Commit Message Guidelines
|
||||
@@ -249,15 +248,15 @@ If the commit reverts a previous commit, it should begin with `revert:`, followe
|
||||
|
||||
Must be one of the following:
|
||||
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **docs**: Documentation only changes
|
||||
* **feature**: A new feature
|
||||
* **bugfix**: A bug fix
|
||||
* **perf**: A code change that improves performance
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* **test**: Adding missing tests or correcting existing tests
|
||||
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
- **docs**: Documentation only changes
|
||||
- **feature**: A new feature
|
||||
- **bugfix**: A bug fix
|
||||
- **perf**: A code change that improves performance
|
||||
- **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
- **test**: Adding missing tests or correcting existing tests
|
||||
|
||||
### Scope
|
||||
|
||||
@@ -265,28 +264,28 @@ The scope should be the name of the npm package affected (as perceived by person
|
||||
|
||||
The following is the list of supported scopes:
|
||||
|
||||
* **common**
|
||||
* **core**
|
||||
* **sample**
|
||||
* **microservices**
|
||||
* **testing**
|
||||
* **websockets**
|
||||
- **common**
|
||||
- **core**
|
||||
- **sample**
|
||||
- **microservices**
|
||||
- **testing**
|
||||
- **websockets**
|
||||
|
||||
There are currently a few exceptions to the "use package name" rule:
|
||||
|
||||
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
* **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
* **sample/#**: for the example apps directory, replacing # with the example app number
|
||||
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
|
||||
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
|
||||
- **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
- **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
- **sample/#**: for the example apps directory, replacing # with the example app number
|
||||
- none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
|
||||
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
|
||||
|
||||
### Subject
|
||||
|
||||
The subject contains succinct description of the change:
|
||||
|
||||
* use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
* don't capitalize first letter
|
||||
* no dot (.) at the end
|
||||
- use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
- don't capitalize first letter
|
||||
- no dot (.) at the end
|
||||
|
||||
### Body
|
||||
|
||||
|
||||
@@ -2,18 +2,15 @@
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
|
||||
864
integration/graphql/package-lock.json
generated
864
integration/graphql/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,11 +9,11 @@
|
||||
"start:prod": "node dist/main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/graphql": "6.4.2",
|
||||
"apollo-server-express": "2.8.1",
|
||||
"graphql": "14.5.0",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/graphql": "6.5.0",
|
||||
"apollo-server-express": "2.9.3",
|
||||
"graphql": "14.5.4",
|
||||
"graphql-tools": "4.0.5",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
|
||||
59
integration/hello-world/e2e/middleware-execute-order.spec.ts
Normal file
59
integration/hello-world/e2e/middleware-execute-order.spec.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { INestApplication, MiddlewareConsumer, Module } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
|
||||
const RETURN_VALUE_A = 'test_A';
|
||||
const RETURN_VALUE_B = 'test_B';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
})
|
||||
class ModuleA {
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
consumer
|
||||
.apply((req, res, next) => {
|
||||
res.send(RETURN_VALUE_A);
|
||||
})
|
||||
.forRoutes('hello');
|
||||
}
|
||||
}
|
||||
|
||||
@Module({
|
||||
imports: [ModuleA],
|
||||
})
|
||||
class ModuleB {
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
consumer
|
||||
.apply((req, res, next) => {
|
||||
res.send(RETURN_VALUE_B);
|
||||
})
|
||||
.forRoutes('hello');
|
||||
}
|
||||
}
|
||||
|
||||
@Module({
|
||||
imports: [ModuleB],
|
||||
})
|
||||
class TestModule {}
|
||||
|
||||
describe('Middleware (execution order)', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeEach(async () => {
|
||||
app = (await Test.createTestingModule({
|
||||
imports: [TestModule],
|
||||
}).compile()).createNestApplication();
|
||||
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it(`should execute middleware in topological order`, () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/hello')
|
||||
.expect(200, RETURN_VALUE_B);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await app.close();
|
||||
});
|
||||
});
|
||||
106
integration/hello-world/package-lock.json
generated
106
integration/hello-world/package-lock.json
generated
@@ -5,32 +5,32 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/microservices": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
|
||||
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
|
||||
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0",
|
||||
"json-socket": "0.3.0",
|
||||
@@ -38,17 +38,17 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/testing": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
|
||||
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
|
||||
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
|
||||
"requires": {
|
||||
"optional": "0.1.4"
|
||||
}
|
||||
},
|
||||
"@nestjs/websockets": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
|
||||
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
|
||||
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0"
|
||||
}
|
||||
@@ -121,9 +121,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"avvio": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.1.tgz",
|
||||
"integrity": "sha512-k+gTocL3yShwN1PtKEsSj7eFiApcZ4JZLAu/ecyzEb8jyx+Kmxb+7SXUsodB47g7fqhs/zkfsCdqq72a1ok5Ew==",
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.2.tgz",
|
||||
"integrity": "sha512-7+yznbJOMoHQ8Z8VH+1meyRjtxUW8za6gqnHBl8DqlX5qPtaclNIgWrKrTLuIbfn2+1/EGkcr+rQXI8DYVU4RA==",
|
||||
"requires": {
|
||||
"archy": "^1.0.0",
|
||||
"debug": "^4.0.0",
|
||||
@@ -227,9 +227,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"cookiejar": {
|
||||
"version": "2.1.2",
|
||||
@@ -278,9 +278,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -372,19 +372,19 @@
|
||||
"integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg=="
|
||||
},
|
||||
"fastify": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.7.1.tgz",
|
||||
"integrity": "sha512-ScKPXD84lkdCgz7q0zjyBr1aLxKbXRt9HYL3XIt/L8ZD2f3fAcsLEyQ2/rHxLUzLGjPlEjIvprWUL3RZvlLRLw==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.8.0.tgz",
|
||||
"integrity": "sha512-+HXe9xZzbj79680hlehEs0B1Z3e5RQT6CtPthseqgRJy2i7Wlro8EEdM7u7ewwL9XREjLWssCPlJiZ3G+t4qsw==",
|
||||
"requires": {
|
||||
"abstract-logging": "^1.0.0",
|
||||
"ajv": "^6.10.2",
|
||||
"avvio": "^6.1.1",
|
||||
"fast-json-stringify": "^1.15.0",
|
||||
"avvio": "^6.2.2",
|
||||
"fast-json-stringify": "^1.15.4",
|
||||
"find-my-way": "^2.0.0",
|
||||
"flatstr": "^1.0.12",
|
||||
"light-my-request": "^3.4.1",
|
||||
"middie": "^4.0.1",
|
||||
"pino": "^5.13.1",
|
||||
"pino": "^5.13.2",
|
||||
"proxy-addr": "^2.0.4",
|
||||
"readable-stream": "^3.1.1",
|
||||
"rfdc": "^1.1.2",
|
||||
@@ -401,9 +401,9 @@
|
||||
}
|
||||
},
|
||||
"find-my-way": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.0.tgz",
|
||||
"integrity": "sha512-Hdx6ctcrzkZH5y9EREHtXryXAgc5Bc8z5Cvoa61y9kaoYj2KU4yXD6h8b6u0NUkYPVmQQeRdf0AtG1kQxQ+ukQ==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.1.tgz",
|
||||
"integrity": "sha512-yznKDx1xELFkTrV2Ke9x3IOr9zn5isdFA2Af/NKjU8kmQQhtn3TmqrVZ6OiLO5pj1dAScxe4dAo92ieG4nGcoA==",
|
||||
"requires": {
|
||||
"fast-decode-uri-component": "^1.0.0",
|
||||
"safe-regex2": "^2.0.0",
|
||||
@@ -595,9 +595,9 @@
|
||||
"integrity": "sha512-ZOtfhPttCrqp2M1PBBH4X13XlvnfhIwD7yCLx+GoGoXRPQyxGOTdQMpIzPSPKXAJT/JQrdfFrgdJOyAzvgpQ9A=="
|
||||
},
|
||||
"pino": {
|
||||
"version": "5.13.1",
|
||||
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.1.tgz",
|
||||
"integrity": "sha512-IxusG28L0g50uuf21kZELypdFOeNrJ/kRhktdi7LtdZQWCxLliMxG5iOrGUQ/ng7MiJ4XqXi/hfyXwZeKc1MxA==",
|
||||
"version": "5.13.2",
|
||||
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.2.tgz",
|
||||
"integrity": "sha512-WwOSCy36/gWhinsqWqAnuwIi2WtcH+jvoyeLm3bjUALIrzWIst0AovQjK4jVvSN2l64KFPfi3gd2fjsTovjdLQ==",
|
||||
"requires": {
|
||||
"fast-redact": "^1.4.4",
|
||||
"fast-safe-stringify": "^2.0.6",
|
||||
@@ -684,7 +684,8 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"safe-regex2": {
|
||||
"version": "2.0.0",
|
||||
@@ -729,11 +730,18 @@
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
|
||||
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
"safe-buffer": "~5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
||||
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"superagent": {
|
||||
@@ -837,9 +845,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -860,9 +868,9 @@
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/microservices": "6.5.3",
|
||||
"@nestjs/testing": "6.5.3",
|
||||
"@nestjs/websockets": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/microservices": "6.6.6",
|
||||
"@nestjs/testing": "6.6.6",
|
||||
"@nestjs/websockets": "6.6.6",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"fastify": "2.7.1",
|
||||
"fastify": "2.8.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
"typescript": "3.5.3"
|
||||
|
||||
55
integration/hooks/e2e/before-app-shutdown.spec.ts
Normal file
55
integration/hooks/e2e/before-app-shutdown.spec.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { Injectable, BeforeApplicationShutdown } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as Sinon from 'sinon';
|
||||
|
||||
@Injectable()
|
||||
class TestInjectable implements BeforeApplicationShutdown {
|
||||
beforeApplicationShutdown = Sinon.spy();
|
||||
}
|
||||
|
||||
describe('BeforeApplicationShutdown', () => {
|
||||
it('should call `beforeApplicationShutdown` when application closes', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [TestInjectable],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.close();
|
||||
const instance = module.get(TestInjectable);
|
||||
expect(instance.beforeApplicationShutdown.called).to.be.true;
|
||||
});
|
||||
|
||||
it('should not stop the server once beforeApplicationShutdown has been called', async () => {
|
||||
let resolve;
|
||||
const promise = new Promise(r => (resolve = r));
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{
|
||||
provide: 'Test',
|
||||
useValue: {
|
||||
beforeApplicationShutdown: () => promise,
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compile();
|
||||
Sinon.stub(module, 'dispose' as any);
|
||||
const app = module.createNestApplication();
|
||||
|
||||
app.close();
|
||||
|
||||
expect(((module as any).dispose as Sinon.SinonSpy).called, 'dispose')
|
||||
.to.be.false;
|
||||
|
||||
resolve();
|
||||
|
||||
setTimeout(
|
||||
() =>
|
||||
expect(
|
||||
((module as any).dispose as Sinon.SinonSpy).called,
|
||||
'dispose',
|
||||
).to.be.true,
|
||||
0,
|
||||
);
|
||||
});
|
||||
});
|
||||
54
integration/hooks/e2e/enable-shutdown-hook.spec.ts
Normal file
54
integration/hooks/e2e/enable-shutdown-hook.spec.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { expect } from 'chai';
|
||||
import { spawnSync } from 'child_process';
|
||||
import { join } from 'path';
|
||||
|
||||
describe('enableShutdownHooks', () => {
|
||||
it('should call the correct hooks if any shutdown signal gets invoked', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
|
||||
'SIGHUP',
|
||||
]);
|
||||
const calls = result.stdout
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map((call: string) => call.trim());
|
||||
expect(calls[0]).to.equal('beforeApplicationShutdown SIGHUP');
|
||||
expect(calls[1]).to.equal('onApplicationShutdown SIGHUP');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should call the correct hooks if a specific shutdown signal gets invoked', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
|
||||
'SIGINT',
|
||||
'SIGINT',
|
||||
]);
|
||||
const calls = result.stdout
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map((call: string) => call.trim());
|
||||
expect(calls[0]).to.equal('beforeApplicationShutdown SIGINT');
|
||||
expect(calls[1]).to.equal('onApplicationShutdown SIGINT');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should ignore system signals which are not specified', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
|
||||
'SIGINT',
|
||||
'SIGHUP',
|
||||
]);
|
||||
expect(result.stdout.toString().trim()).to.be.eq('');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should ignore system signals if "enableShutdownHooks" was not called', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
|
||||
'SIGINT',
|
||||
'NONE',
|
||||
]);
|
||||
expect(result.stdout.toString().trim()).to.be.eq('');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as Sinon from 'sinon';
|
||||
import {
|
||||
Injectable,
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
OnApplicationShutdown,
|
||||
OnModuleDestroy,
|
||||
OnModuleInit,
|
||||
BeforeApplicationShutdown,
|
||||
} from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
@@ -15,8 +15,10 @@ class TestInjectable
|
||||
OnApplicationBootstrap,
|
||||
OnModuleInit,
|
||||
OnModuleDestroy,
|
||||
OnApplicationShutdown {
|
||||
OnApplicationShutdown,
|
||||
BeforeApplicationShutdown {
|
||||
onApplicationBootstrap = Sinon.spy();
|
||||
beforeApplicationShutdown = Sinon.spy();
|
||||
onApplicationShutdown = Sinon.spy();
|
||||
onModuleDestroy = Sinon.spy();
|
||||
onModuleInit = Sinon.spy();
|
||||
@@ -37,6 +39,7 @@ describe('Lifecycle Hook Order', () => {
|
||||
instance.onModuleInit,
|
||||
instance.onApplicationBootstrap,
|
||||
instance.onModuleDestroy,
|
||||
instance.beforeApplicationShutdown,
|
||||
instance.onApplicationShutdown,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -19,4 +19,26 @@ describe('OnApplicationBootstrap', () => {
|
||||
const instance = module.get(TestInjectable);
|
||||
expect(instance.onApplicationBootstrap.called).to.be.true;
|
||||
});
|
||||
|
||||
it('should not throw an error when onApplicationBootstrap is null', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onApplicationBootstrap: null } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
|
||||
it('should not throw an error when onApplicationBootstrap is undefined', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onApplicationBootstrap: undefined } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import { spawnSync } from 'child_process';
|
||||
import { join } from 'path';
|
||||
import * as Sinon from 'sinon';
|
||||
|
||||
@Injectable()
|
||||
@@ -21,43 +19,4 @@ describe('OnApplicationShutdown', () => {
|
||||
const instance = module.get(TestInjectable);
|
||||
expect(instance.onApplicationShutdown.called).to.be.true;
|
||||
});
|
||||
|
||||
it('should call onApplicationShutdown if any shutdown signal gets invoked', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/main.ts'),
|
||||
'SIGHUP',
|
||||
]);
|
||||
expect(result.stdout.toString().trim() === 'Signal SIGHUP').to.be.true;
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should call onApplicationShutdown if a specific shutdown signal gets invoked', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/main.ts'),
|
||||
'SIGINT',
|
||||
'SIGINT',
|
||||
]);
|
||||
expect(result.stdout.toString().trim()).to.be.eq('Signal SIGINT');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should ignore system signals which are not specified', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/main.ts'),
|
||||
'SIGINT',
|
||||
'SIGHUP',
|
||||
]);
|
||||
expect(result.stdout.toString().trim()).to.be.eq('');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
|
||||
it('should ignore system signals if "enableShutdownHooks" was not called', done => {
|
||||
const result = spawnSync('ts-node', [
|
||||
join(__dirname, '../src/main.ts'),
|
||||
'SIGINT',
|
||||
'NONE',
|
||||
]);
|
||||
expect(result.stdout.toString().trim()).to.be.eq('');
|
||||
done();
|
||||
}).timeout(5000);
|
||||
});
|
||||
|
||||
@@ -19,4 +19,26 @@ describe('OnModuleDestroy', () => {
|
||||
const instance = module.get(TestInjectable);
|
||||
expect(instance.onModuleDestroy.called).to.be.true;
|
||||
});
|
||||
|
||||
it('should not throw an error when onModuleDestroy is null', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onModuleDestroy: null } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
|
||||
it('should not throw an error when onModuleDestroy is undefined', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onModuleDestroy: undefined } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,4 +19,26 @@ describe('OnModuleInit', () => {
|
||||
const instance = module.get(TestInjectable);
|
||||
expect(instance.onModuleInit.called).to.be.true;
|
||||
});
|
||||
|
||||
it('should not throw an error when onModuleInit is null', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onModuleInit: null } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
|
||||
it('should not throw an error when onModuleInit is undefined', async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
providers: [
|
||||
{ provide: 'TEST', useValue: { onModuleInit: undefined } }
|
||||
],
|
||||
}).compile();
|
||||
|
||||
const app = module.createNestApplication();
|
||||
await app.init().then((obj) => expect(obj).to.not.be.undefined);
|
||||
});
|
||||
});
|
||||
|
||||
40
integration/hooks/package-lock.json
generated
40
integration/hooks/package-lock.json
generated
@@ -5,26 +5,26 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nuxtjs/opencollective": {
|
||||
@@ -155,9 +155,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"cookiejar": {
|
||||
"version": "2.1.2",
|
||||
@@ -202,9 +202,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -562,9 +562,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -578,9 +578,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { Injectable, OnApplicationShutdown, Module } from '@nestjs/common';
|
||||
import { Injectable, OnApplicationShutdown, BeforeApplicationShutdown, Module } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
const SIGNAL = process.argv[2];
|
||||
const SIGNAL_TO_LISTEN = process.argv[3];
|
||||
|
||||
@Injectable()
|
||||
class TestInjectable implements OnApplicationShutdown {
|
||||
class TestInjectable implements OnApplicationShutdown, BeforeApplicationShutdown {
|
||||
beforeApplicationShutdown(signal: string) {
|
||||
console.log('beforeApplicationShutdown ' + signal);
|
||||
}
|
||||
|
||||
onApplicationShutdown(signal: string) {
|
||||
console.log('Signal ' + signal);
|
||||
console.log('onApplicationShutdown ' + signal);
|
||||
}
|
||||
}
|
||||
|
||||
54
integration/injector/e2e/scoped-instances.spec.ts
Normal file
54
integration/injector/e2e/scoped-instances.spec.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { InvalidClassScopeException } from '@nestjs/core/errors/exceptions/invalid-class-scope.exception';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import { ScopedController } from '../src/scoped/scoped.controller';
|
||||
import { ScopedModule } from '../src/scoped/scoped.module';
|
||||
import { ScopedService } from '../src/scoped/scoped.service';
|
||||
import { TransientService } from '../src/scoped/transient.service';
|
||||
|
||||
describe('Scoped Instances', () => {
|
||||
let testingModule: TestingModule;
|
||||
|
||||
beforeEach(async () => {
|
||||
testingModule = await Test.createTestingModule({
|
||||
imports: [ScopedModule],
|
||||
}).compile();
|
||||
});
|
||||
|
||||
it('should dynamically resolve transient provider', async () => {
|
||||
const transient1 = await testingModule.resolve(TransientService);
|
||||
const transient2 = await testingModule.resolve(TransientService);
|
||||
|
||||
expect(transient1).to.be.instanceOf(TransientService);
|
||||
expect(transient2).to.be.instanceOf(TransientService);
|
||||
expect(transient1).to.be.equal(transient2);
|
||||
});
|
||||
|
||||
it('should dynamically resolve request-scoped provider', async () => {
|
||||
const request1 = await testingModule.resolve(ScopedService);
|
||||
const request2 = await testingModule.resolve(ScopedService);
|
||||
const request3 = await testingModule.resolve(ScopedService, { id: 1 });
|
||||
|
||||
expect(request1).to.be.instanceOf(ScopedService);
|
||||
expect(request2).to.be.instanceOf(ScopedService);
|
||||
expect(request3).to.not.be.equal(request2);
|
||||
});
|
||||
|
||||
it('should dynamically resolve request-scoped controller', async () => {
|
||||
const request1 = await testingModule.resolve(ScopedController);
|
||||
const request2 = await testingModule.resolve(ScopedController);
|
||||
const request3 = await testingModule.resolve(ScopedController, { id: 1 });
|
||||
|
||||
expect(request1).to.be.instanceOf(ScopedController);
|
||||
expect(request2).to.be.instanceOf(ScopedController);
|
||||
expect(request3).to.not.be.equal(request2);
|
||||
});
|
||||
|
||||
it('should throw an exception when "get()" method is used', async () => {
|
||||
try {
|
||||
testingModule.get(ScopedController);
|
||||
} catch (err) {
|
||||
expect(err).to.be.instanceOf(InvalidClassScopeException);
|
||||
}
|
||||
});
|
||||
});
|
||||
58
integration/injector/package-lock.json
generated
58
integration/injector/package-lock.json
generated
@@ -5,32 +5,32 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/microservices": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
|
||||
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
|
||||
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0",
|
||||
"json-socket": "0.3.0",
|
||||
@@ -38,17 +38,17 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/testing": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
|
||||
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
|
||||
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
|
||||
"requires": {
|
||||
"optional": "0.1.4"
|
||||
}
|
||||
},
|
||||
"@nestjs/websockets": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
|
||||
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
|
||||
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0"
|
||||
}
|
||||
@@ -181,9 +181,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"cookiejar": {
|
||||
"version": "2.1.2",
|
||||
@@ -228,9 +228,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -593,9 +593,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -609,9 +609,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/microservices": "6.5.3",
|
||||
"@nestjs/testing": "6.5.3",
|
||||
"@nestjs/websockets": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/microservices": "6.6.6",
|
||||
"@nestjs/testing": "6.6.6",
|
||||
"@nestjs/websockets": "6.6.6",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
|
||||
7
integration/injector/src/scoped/scoped.controller.ts
Normal file
7
integration/injector/src/scoped/scoped.controller.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Controller, Scope } from '@nestjs/common';
|
||||
|
||||
@Controller({
|
||||
path: 'test',
|
||||
scope: Scope.REQUEST,
|
||||
})
|
||||
export class ScopedController {}
|
||||
10
integration/injector/src/scoped/scoped.module.ts
Normal file
10
integration/injector/src/scoped/scoped.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ScopedController } from './scoped.controller';
|
||||
import { ScopedService } from './scoped.service';
|
||||
import { TransientService } from './transient.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ScopedController],
|
||||
providers: [ScopedService, TransientService],
|
||||
})
|
||||
export class ScopedModule {}
|
||||
4
integration/injector/src/scoped/scoped.service.ts
Normal file
4
integration/injector/src/scoped/scoped.service.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { Injectable, Scope } from '@nestjs/common';
|
||||
|
||||
@Injectable({ scope: Scope.REQUEST })
|
||||
export class ScopedService {}
|
||||
4
integration/injector/src/scoped/transient.service.ts
Normal file
4
integration/injector/src/scoped/transient.service.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { Injectable, Scope } from '@nestjs/common';
|
||||
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class TransientService {}
|
||||
@@ -18,9 +18,15 @@ describe('MQTT transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
|
||||
@@ -18,9 +18,15 @@ describe('NATS transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
url: 'nats://0.0.0.0:4222',
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
url: 'nats://0.0.0.0:4222',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
|
||||
@@ -18,9 +18,15 @@ describe('REDIS transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
|
||||
@@ -19,6 +19,9 @@ describe('MQTT transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
url: 'mqtt://0.0.0.0:1883',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
@@ -46,6 +49,8 @@ describe('MQTT transport', () => {
|
||||
.expect(200, '15');
|
||||
});
|
||||
|
||||
/**
|
||||
* Figure out race conditions here (flaky tests)
|
||||
it(`/POST (concurrent)`, function() {
|
||||
this.retries(10);
|
||||
return request(server)
|
||||
@@ -63,7 +68,7 @@ describe('MQTT transport', () => {
|
||||
Array.from({ length: 10 }, (v, k) => k + 91),
|
||||
])
|
||||
.expect(200, 'true');
|
||||
}).timeout(5000);
|
||||
}).timeout(5000); */
|
||||
|
||||
it(`/POST (streaming)`, () => {
|
||||
return request(server)
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('NATS transport', () => {
|
||||
app.connectMicroservice({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
url: 'nats://localhost:4222',
|
||||
url: 'nats://0.0.0.0:4222',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
|
||||
@@ -19,6 +19,9 @@ describe('REDIS transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('RabbitMQ transport', () => {
|
||||
app.connectMicroservice({
|
||||
transport: Transport.RMQ,
|
||||
options: {
|
||||
urls: [`amqp://localhost:5672`],
|
||||
urls: [`amqp://0.0.0.0:5672`],
|
||||
queue: 'test',
|
||||
queueOptions: { durable: false },
|
||||
socketOptions: { noDelay: true },
|
||||
|
||||
@@ -20,6 +20,9 @@ describe('RPC transport', () => {
|
||||
|
||||
app.connectMicroservice({
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservicesAsync();
|
||||
await app.init();
|
||||
|
||||
64
integration/microservices/package-lock.json
generated
64
integration/microservices/package-lock.json
generated
@@ -5,32 +5,32 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/microservices": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
|
||||
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
|
||||
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0",
|
||||
"json-socket": "0.3.0",
|
||||
@@ -38,9 +38,9 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/platform-express": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.5.3.tgz",
|
||||
"integrity": "sha512-c5n4XUbDDmF6MfBGYWM1jtsIDpVsOfOQtf3S0w3IeJNqm7dnmVAvO2Jk+RsYpt50tN4NAXntM3YTuTDqMb9uiA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.6.6.tgz",
|
||||
"integrity": "sha512-hOxFCZb4jSv6QO3Y+fY0clxdOC9LYwyD66gSI0wx77LS2R5VM38QIClexfTB6mi12HmYfopIiM7kaj9Fkb2xtQ==",
|
||||
"requires": {
|
||||
"body-parser": "1.19.0",
|
||||
"cors": "2.8.5",
|
||||
@@ -49,17 +49,17 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/testing": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
|
||||
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
|
||||
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
|
||||
"requires": {
|
||||
"optional": "0.1.4"
|
||||
}
|
||||
},
|
||||
"@nestjs/websockets": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
|
||||
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
|
||||
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0"
|
||||
}
|
||||
@@ -324,9 +324,9 @@
|
||||
}
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.3",
|
||||
@@ -431,9 +431,9 @@
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -1117,9 +1117,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.18",
|
||||
@@ -1171,9 +1171,9 @@
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/microservices": "6.5.3",
|
||||
"@nestjs/platform-express": "6.5.3",
|
||||
"@nestjs/testing": "6.5.3",
|
||||
"@nestjs/websockets": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/microservices": "6.6.6",
|
||||
"@nestjs/platform-express": "6.6.6",
|
||||
"@nestjs/testing": "6.6.6",
|
||||
"@nestjs/websockets": "6.6.6",
|
||||
"amqp-connection-manager": "3.0.0",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
|
||||
66
integration/mongoose/package-lock.json
generated
66
integration/mongoose/package-lock.json
generated
@@ -25,26 +25,26 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/mongoose": {
|
||||
@@ -72,9 +72,9 @@
|
||||
}
|
||||
},
|
||||
"@types/mongodb": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.0.tgz",
|
||||
"integrity": "sha512-YMrve0uBOqFDEiezQk3AfWV73g871/rQTAEb8Y2CSlbySnV/2OyerI1DAOUUJQaIqGEWWaYF6GMPO6wTErLUuw==",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.1.tgz",
|
||||
"integrity": "sha512-Va7o1fN3zeabmIJSQ6yuAWkqPvrT38HSTIi4YbVOb2UL7FJ4diXrWt+OUuuEFWAVPtF9VZV5h+7LDYdzgXWgQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/bson": "*",
|
||||
@@ -82,9 +82,9 @@
|
||||
}
|
||||
},
|
||||
"@types/mongoose": {
|
||||
"version": "5.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.13.tgz",
|
||||
"integrity": "sha512-k7Kxk5gugsZhkl7euWH1p6lmIdh9W8AsQgX0cO7kaihBie/P3ywU8LFMqo9ey6frdHBlGVaNICTeFZ/pZ6s5Lg==",
|
||||
"version": "5.5.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.16.tgz",
|
||||
"integrity": "sha512-He7VRmleSucCi63v2Hihy+ii1IqG4nTuXWsNrYXeCk7cBZ4J7jufbNcUNjswsDlSr9Ir1Eai/AQC9qDtecsXtA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/mongodb": "*",
|
||||
@@ -229,9 +229,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"d": {
|
||||
"version": "1.0.1",
|
||||
@@ -264,9 +264,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -415,9 +415,9 @@
|
||||
}
|
||||
},
|
||||
"kareem": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz",
|
||||
"integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg=="
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz",
|
||||
"integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw=="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
@@ -504,13 +504,13 @@
|
||||
}
|
||||
},
|
||||
"mongoose": {
|
||||
"version": "5.6.10",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.10.tgz",
|
||||
"integrity": "sha512-lxWvF4Vl2118K2nZTj+QAEEmNBCbmUAcmF/roe8d+68Np4RXKEQvmpqm1c3aIlE9AVMp//eKB8IfXr38ZHe0Zw==",
|
||||
"version": "5.6.11",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.11.tgz",
|
||||
"integrity": "sha512-+Mxfmu2Jcspmdqk1111BLUj5mzSLHWKVovImkjzO9GMymTwkHshsuSFmUN7ou4dWy2WR8DPSJcwU52HhnnNk8Q==",
|
||||
"requires": {
|
||||
"async": "2.6.2",
|
||||
"bson": "~1.1.1",
|
||||
"kareem": "2.3.0",
|
||||
"kareem": "2.3.1",
|
||||
"mongodb": "3.2.7",
|
||||
"mongodb-core": "3.2.7",
|
||||
"mongoose-legacy-pluralize": "1.0.2",
|
||||
@@ -766,9 +766,9 @@
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -776,9 +776,9 @@
|
||||
"integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
"start:prod": "node dist/main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/mongoose": "6.1.2",
|
||||
"mongoose": "5.6.10",
|
||||
"mongoose": "5.6.11",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
"typescript": "3.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mongoose": "5.5.13",
|
||||
"@types/mongoose": "5.5.16",
|
||||
"@types/node": "7.10.7",
|
||||
"ts-node": "8.3.0",
|
||||
"tslint": "5.19.0"
|
||||
|
||||
106
integration/scopes/package-lock.json
generated
106
integration/scopes/package-lock.json
generated
@@ -5,32 +5,32 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/microservices": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
|
||||
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
|
||||
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0",
|
||||
"json-socket": "0.3.0",
|
||||
@@ -38,17 +38,17 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/testing": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
|
||||
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
|
||||
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
|
||||
"requires": {
|
||||
"optional": "0.1.4"
|
||||
}
|
||||
},
|
||||
"@nestjs/websockets": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
|
||||
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
|
||||
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0"
|
||||
}
|
||||
@@ -121,9 +121,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"avvio": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.1.tgz",
|
||||
"integrity": "sha512-k+gTocL3yShwN1PtKEsSj7eFiApcZ4JZLAu/ecyzEb8jyx+Kmxb+7SXUsodB47g7fqhs/zkfsCdqq72a1ok5Ew==",
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.2.tgz",
|
||||
"integrity": "sha512-7+yznbJOMoHQ8Z8VH+1meyRjtxUW8za6gqnHBl8DqlX5qPtaclNIgWrKrTLuIbfn2+1/EGkcr+rQXI8DYVU4RA==",
|
||||
"requires": {
|
||||
"archy": "^1.0.0",
|
||||
"debug": "^4.0.0",
|
||||
@@ -227,9 +227,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"cookiejar": {
|
||||
"version": "2.1.2",
|
||||
@@ -278,9 +278,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -372,19 +372,19 @@
|
||||
"integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg=="
|
||||
},
|
||||
"fastify": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.7.1.tgz",
|
||||
"integrity": "sha512-ScKPXD84lkdCgz7q0zjyBr1aLxKbXRt9HYL3XIt/L8ZD2f3fAcsLEyQ2/rHxLUzLGjPlEjIvprWUL3RZvlLRLw==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.8.0.tgz",
|
||||
"integrity": "sha512-+HXe9xZzbj79680hlehEs0B1Z3e5RQT6CtPthseqgRJy2i7Wlro8EEdM7u7ewwL9XREjLWssCPlJiZ3G+t4qsw==",
|
||||
"requires": {
|
||||
"abstract-logging": "^1.0.0",
|
||||
"ajv": "^6.10.2",
|
||||
"avvio": "^6.1.1",
|
||||
"fast-json-stringify": "^1.15.0",
|
||||
"avvio": "^6.2.2",
|
||||
"fast-json-stringify": "^1.15.4",
|
||||
"find-my-way": "^2.0.0",
|
||||
"flatstr": "^1.0.12",
|
||||
"light-my-request": "^3.4.1",
|
||||
"middie": "^4.0.1",
|
||||
"pino": "^5.13.1",
|
||||
"pino": "^5.13.2",
|
||||
"proxy-addr": "^2.0.4",
|
||||
"readable-stream": "^3.1.1",
|
||||
"rfdc": "^1.1.2",
|
||||
@@ -401,9 +401,9 @@
|
||||
}
|
||||
},
|
||||
"find-my-way": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.0.tgz",
|
||||
"integrity": "sha512-Hdx6ctcrzkZH5y9EREHtXryXAgc5Bc8z5Cvoa61y9kaoYj2KU4yXD6h8b6u0NUkYPVmQQeRdf0AtG1kQxQ+ukQ==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.1.tgz",
|
||||
"integrity": "sha512-yznKDx1xELFkTrV2Ke9x3IOr9zn5isdFA2Af/NKjU8kmQQhtn3TmqrVZ6OiLO5pj1dAScxe4dAo92ieG4nGcoA==",
|
||||
"requires": {
|
||||
"fast-decode-uri-component": "^1.0.0",
|
||||
"safe-regex2": "^2.0.0",
|
||||
@@ -595,9 +595,9 @@
|
||||
"integrity": "sha512-ZOtfhPttCrqp2M1PBBH4X13XlvnfhIwD7yCLx+GoGoXRPQyxGOTdQMpIzPSPKXAJT/JQrdfFrgdJOyAzvgpQ9A=="
|
||||
},
|
||||
"pino": {
|
||||
"version": "5.13.1",
|
||||
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.1.tgz",
|
||||
"integrity": "sha512-IxusG28L0g50uuf21kZELypdFOeNrJ/kRhktdi7LtdZQWCxLliMxG5iOrGUQ/ng7MiJ4XqXi/hfyXwZeKc1MxA==",
|
||||
"version": "5.13.2",
|
||||
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.2.tgz",
|
||||
"integrity": "sha512-WwOSCy36/gWhinsqWqAnuwIi2WtcH+jvoyeLm3bjUALIrzWIst0AovQjK4jVvSN2l64KFPfi3gd2fjsTovjdLQ==",
|
||||
"requires": {
|
||||
"fast-redact": "^1.4.4",
|
||||
"fast-safe-stringify": "^2.0.6",
|
||||
@@ -684,7 +684,8 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"safe-regex2": {
|
||||
"version": "2.0.0",
|
||||
@@ -729,11 +730,18 @@
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
|
||||
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
"safe-buffer": "~5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
|
||||
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"superagent": {
|
||||
@@ -837,9 +845,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -860,9 +868,9 @@
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/microservices": "6.5.3",
|
||||
"@nestjs/testing": "6.5.3",
|
||||
"@nestjs/websockets": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/microservices": "6.6.6",
|
||||
"@nestjs/testing": "6.6.6",
|
||||
"@nestjs/websockets": "6.6.6",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"fastify": "2.7.1",
|
||||
"fastify": "2.8.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
"typescript": "3.5.3"
|
||||
|
||||
789
integration/typegraphql/package-lock.json
generated
789
integration/typegraphql/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,13 +9,13 @@
|
||||
"start:prod": "node dist/main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/graphql": "6.4.2",
|
||||
"apollo-server-express": "2.8.1",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/graphql": "6.5.0",
|
||||
"apollo-server-express": "2.9.3",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"graphql": "14.5.0",
|
||||
"graphql": "14.5.4",
|
||||
"graphql-tools": "4.0.5",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
|
||||
48
integration/typeorm/package-lock.json
generated
48
integration/typeorm/package-lock.json
generated
@@ -25,26 +25,40 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@nestjs/typeorm": {
|
||||
@@ -256,9 +270,9 @@
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
@@ -324,9 +338,9 @@
|
||||
}
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -1057,9 +1071,9 @@
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typeorm": {
|
||||
"version": "0.2.18",
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
"start:prod": "node dist/main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/typeorm": "6.1.3",
|
||||
"mysql": "2.17.1",
|
||||
"reflect-metadata": "0.1.13",
|
||||
|
||||
58
integration/websockets/package-lock.json
generated
58
integration/websockets/package-lock.json
generated
@@ -5,32 +5,32 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@nestjs/common": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
|
||||
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
|
||||
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"cli-color": "1.4.0",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/core": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
|
||||
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
|
||||
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
|
||||
"requires": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"iterare": "1.2.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"uuid": "3.3.2"
|
||||
"uuid": "3.3.3"
|
||||
}
|
||||
},
|
||||
"@nestjs/microservices": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
|
||||
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
|
||||
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0",
|
||||
"json-socket": "0.3.0",
|
||||
@@ -38,17 +38,17 @@
|
||||
}
|
||||
},
|
||||
"@nestjs/testing": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
|
||||
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
|
||||
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
|
||||
"requires": {
|
||||
"optional": "0.1.4"
|
||||
}
|
||||
},
|
||||
"@nestjs/websockets": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
|
||||
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
|
||||
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
|
||||
"requires": {
|
||||
"iterare": "1.2.0"
|
||||
}
|
||||
@@ -181,9 +181,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"consola": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
|
||||
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
|
||||
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
|
||||
},
|
||||
"cookiejar": {
|
||||
"version": "2.1.2",
|
||||
@@ -228,9 +228,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"es5-ext": {
|
||||
"version": "0.10.50",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
|
||||
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
|
||||
"version": "0.10.51",
|
||||
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
|
||||
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
|
||||
"requires": {
|
||||
"es6-iterator": "~2.0.3",
|
||||
"es6-symbol": "~3.1.1",
|
||||
@@ -593,9 +593,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"type": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
|
||||
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
|
||||
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.5.3",
|
||||
@@ -609,9 +609,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
|
||||
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"validator": {
|
||||
"version": "11.1.0",
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
"start": "ts-node src/main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "6.5.3",
|
||||
"@nestjs/core": "6.5.3",
|
||||
"@nestjs/microservices": "6.5.3",
|
||||
"@nestjs/testing": "6.5.3",
|
||||
"@nestjs/websockets": "6.5.3",
|
||||
"@nestjs/common": "6.6.6",
|
||||
"@nestjs/core": "6.6.6",
|
||||
"@nestjs/microservices": "6.6.6",
|
||||
"@nestjs/testing": "6.6.6",
|
||||
"@nestjs/websockets": "6.6.6",
|
||||
"class-transformer": "0.2.3",
|
||||
"class-validator": "0.10.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "6.5.3"
|
||||
"version": "6.6.7"
|
||||
}
|
||||
|
||||
599
package-lock.json
generated
599
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/core",
|
||||
"version": "6.5.3",
|
||||
"version": "6.6.5",
|
||||
"description": "Modern, fast, powerful node.js web framework",
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
@@ -9,17 +9,19 @@
|
||||
"lint": "tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\" -e \"*.spec.ts\"",
|
||||
"format": "prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
|
||||
"clean": "gulp clean:bundle",
|
||||
"build": "npm run clean && gulp build",
|
||||
"prebuild:dev": "rm -rf node_modules/@nestjs",
|
||||
"build:dev": "gulp build --dist node_modules/@nestjs && gulp move",
|
||||
"build:samples": "gulp install:samples && npm run build:dev && gulp build:samples",
|
||||
"prebuild": "rm -rf node_modules/@nestjs",
|
||||
"build": "gulp build --dist node_modules/@nestjs",
|
||||
"postbuild": "gulp move",
|
||||
"prebuild:prod": "npm run clean",
|
||||
"build:prod": "gulp build",
|
||||
"build:samples": "gulp install:samples && npm run build && gulp build:samples",
|
||||
"postinstall": "opencollective",
|
||||
"prerelease": "gulp copy-misc && gulp build --dist node_modules/@nestjs",
|
||||
"publish": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --access public --exact -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:rc": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=rc --access public -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:next": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=next --access public --skip-git -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:beta": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=beta --access public -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:test": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --access public --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
|
||||
"publish": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --force-publish --access public --exact -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:rc": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=rc --access public -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:next": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=next --access public --skip-git -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:beta": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=beta --access public -m \"chore(@nestjs) publish %s release\"",
|
||||
"publish:test": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --force-publish --access public --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.9.0"
|
||||
@@ -40,7 +42,7 @@
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"amqp-connection-manager": "3.0.0",
|
||||
"amqplib": "0.5.5",
|
||||
"apollo-server-express": "2.8.1",
|
||||
"apollo-server-express": "2.9.3",
|
||||
"axios": "0.19.0",
|
||||
"cache-manager": "2.10.0",
|
||||
"class-transformer": "0.2.3",
|
||||
@@ -52,11 +54,11 @@
|
||||
"express": "4.17.1",
|
||||
"fast-json-stringify": "1.15.4",
|
||||
"fast-safe-stringify": "2.0.6",
|
||||
"fastify": "2.7.1",
|
||||
"fastify": "2.8.0",
|
||||
"fastify-cors": "2.1.3",
|
||||
"fastify-formbody": "3.1.0",
|
||||
"fastify-multipart": "1.0.2",
|
||||
"graphql": "14.5.0",
|
||||
"graphql": "14.5.4",
|
||||
"grpc": "1.23.3",
|
||||
"http2": "3.3.7",
|
||||
"iterare": "1.2.0",
|
||||
@@ -66,14 +68,14 @@
|
||||
"nats": "1.3.0",
|
||||
"object-hash": "1.3.1",
|
||||
"optional": "0.1.4",
|
||||
"path-to-regexp": "3.0.0",
|
||||
"path-to-regexp": "3.1.0",
|
||||
"pump": "3.0.0",
|
||||
"redis": "2.8.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.2",
|
||||
"rxjs-compat": "6.5.2",
|
||||
"socket.io": "2.2.0",
|
||||
"ts-morph": "3.1.3",
|
||||
"ts-morph": "4.0.0",
|
||||
"uuid": "3.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -87,7 +89,7 @@
|
||||
"@types/gulp": "4.0.6",
|
||||
"@types/kafka-node": "2.0.8",
|
||||
"@types/mocha": "5.2.7",
|
||||
"@types/node": "10.14.16",
|
||||
"@types/node": "10.14.17",
|
||||
"@types/redis": "2.8.13",
|
||||
"@types/reflect-metadata": "0.0.5",
|
||||
"@types/sinon": "7.0.13",
|
||||
@@ -117,18 +119,18 @@
|
||||
"imports-loader": "0.8.0",
|
||||
"json-loader": "0.5.7",
|
||||
"lerna": "2.11.0",
|
||||
"lint-staged": "9.2.3",
|
||||
"lint-staged": "9.2.5",
|
||||
"mocha": "3.5.3",
|
||||
"nodemon": "1.19.1",
|
||||
"nyc": "14.1.1",
|
||||
"prettier": "1.18.2",
|
||||
"sinon": "7.4.1",
|
||||
"sinon": "7.4.2",
|
||||
"sinon-chai": "3.3.0",
|
||||
"socket.io-client": "2.2.0",
|
||||
"supertest": "4.0.2",
|
||||
"ts-node": "8.3.0",
|
||||
"tslint": "5.19.0",
|
||||
"typescript": "3.5.3"
|
||||
"typescript": "3.6.2"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
|
||||
1
packages/common/PACKAGE.md
Normal file
1
packages/common/PACKAGE.md
Normal file
@@ -0,0 +1 @@
|
||||
The common package comes with decorators such as `@Controller()`, `@Injectable()` and so on.
|
||||
@@ -2,18 +2,15 @@
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
@@ -60,25 +57,23 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="125" valign="middle" /> </a> <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="180" valign="middle" /></a>
|
||||
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="130" valign="middle" /></a>
|
||||
<a href="https://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="100" valign="middle" /></a> <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="26" valign="middle" /></a> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="30" valign="middle" /></a>
|
||||
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="36" valign="middle" /></a> <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="24" valign="middle" /></a> <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="28" valign="middle" /></a> <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="20" valign="middle" /></a> <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="30" valign="middle" /></a>
|
||||
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="20" valign="middle" /></a>
|
||||
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="35" valign="middle" /></a>
|
||||
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="31" valign="middle" /></a>
|
||||
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="28" valign="middle" /></a> <a href="https://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="80" valign="middle" /></a>
|
||||
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="120" valign="middle" /></a>
|
||||
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="90" valign="middle" /></a>
|
||||
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="145" valign="middle" /></a>
|
||||
<a href="http://xtremis.com/" target="_blank"><img src="https://nestjs.com/img/logo-xtremis.svg" width="145" valign="middle" /></a>
|
||||
|
||||
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a> <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a>
|
||||
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a>
|
||||
<a href="https://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="80" valign="middle" /></a> <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="22" valign="middle" /></a> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="24" valign="middle" /></a>
|
||||
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="14" valign="middle" /></a>
|
||||
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a>
|
||||
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="24" valign="middle" /></a> <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a>
|
||||
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> <a href="https://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="70" valign="middle" /></a>
|
||||
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a>
|
||||
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a>
|
||||
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a>
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a>
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a>
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1600"></a>
|
||||
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1000"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
|
||||
22
packages/common/cache/cache.module.ts
vendored
22
packages/common/cache/cache.module.ts
vendored
@@ -8,11 +8,25 @@ import {
|
||||
CacheOptionsFactory,
|
||||
} from './interfaces/cache-module.interface';
|
||||
|
||||
/**
|
||||
* Module that provides Nest cache-manager.
|
||||
*
|
||||
* @see [Caching](https://docs.nestjs.com/techniques/caching)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Module({
|
||||
providers: [createCacheManager()],
|
||||
exports: [CACHE_MANAGER],
|
||||
})
|
||||
export class CacheModule {
|
||||
/**
|
||||
* Configure the cache manager statically.
|
||||
*
|
||||
* @param options options to configure the cache manager
|
||||
*
|
||||
* @see [Customize caching](https://docs.nestjs.com/techniques/caching#customize-caching)
|
||||
*/
|
||||
static register(options: CacheModuleOptions = {}): DynamicModule {
|
||||
return {
|
||||
module: CacheModule,
|
||||
@@ -20,6 +34,14 @@ export class CacheModule {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the cache manager dynamically.
|
||||
*
|
||||
* @param options method for dynamically supplying cache manager configuration
|
||||
* options
|
||||
*
|
||||
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
|
||||
*/
|
||||
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule {
|
||||
return {
|
||||
module: CacheModule,
|
||||
|
||||
5
packages/common/cache/cache.providers.ts
vendored
5
packages/common/cache/cache.providers.ts
vendored
@@ -4,6 +4,11 @@ import { CACHE_MANAGER, CACHE_MODULE_OPTIONS } from './cache.constants';
|
||||
import { defaultCacheOptions } from './default-options';
|
||||
import { CacheManagerOptions } from './interfaces/cache-manager.interface';
|
||||
|
||||
/**
|
||||
* Creates a CacheManager Provider.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function createCacheManager(): Provider {
|
||||
return {
|
||||
provide: CACHE_MANAGER,
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
import { SetMetadata } from '../../decorators';
|
||||
import { CACHE_KEY_METADATA } from '../cache.constants';
|
||||
|
||||
/**
|
||||
* Decorator that sets the caching key used to store/retrieve cached items for
|
||||
* Web sockets or Microservice based apps.
|
||||
*
|
||||
* For example:
|
||||
* `@CacheKey('events')`
|
||||
*
|
||||
* @param key string naming the field to be used as a cache key
|
||||
*
|
||||
* @see [Caching](https://docs.nestjs.com/techniques/caching)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const CacheKey = (key: string) => SetMetadata(CACHE_KEY_METADATA, key);
|
||||
|
||||
@@ -2,19 +2,70 @@ export interface LiteralObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining a cache store. Implement this interface to create a custom
|
||||
* cache store.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CacheStore {
|
||||
/**
|
||||
* Create a key/value pair in the cache.
|
||||
*
|
||||
* @param key cache key
|
||||
* @param value cache value
|
||||
*/
|
||||
set<T>(key: string, value: T): Promise<void> | void;
|
||||
/**
|
||||
* Retrieve a key/value pair from the cache.
|
||||
*
|
||||
* @param key cache key
|
||||
*/
|
||||
get<T>(key: string): Promise<void> | void;
|
||||
/**
|
||||
* Destroy a key/value pair from the cache.
|
||||
*
|
||||
* @param key cache key
|
||||
*/
|
||||
del(key: string): void | Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining a factory to create a cache store.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CacheStoreFactory {
|
||||
/**
|
||||
* Return a configured cache store.
|
||||
*
|
||||
* @param args Cache manager options received from `CacheModule.register()`
|
||||
* or `CacheModule.registerAcync()`
|
||||
*/
|
||||
create(args: LiteralObject): CacheStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining Cache Manager configuration options.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CacheManagerOptions {
|
||||
/**
|
||||
* Cache storage manager. Default is `'memory'` (in-memory store). See
|
||||
* [Different stores](https://docs.nestjs.com/techniques/caching#different-stores)
|
||||
* for more info.
|
||||
*/
|
||||
store?: string | CacheStoreFactory;
|
||||
/**
|
||||
* Time to live - amount of time in seconds that a response is cached before it
|
||||
* is deleted. Subsequent request will call through the route handler and refresh
|
||||
* the cache. Defaults to 5 seconds.
|
||||
*/
|
||||
ttl?: number;
|
||||
/**
|
||||
* Maximum number of responses to store in the cache. Defaults to 100.
|
||||
*/
|
||||
max?: number;
|
||||
isCacheableValue?: (value: any) => boolean;
|
||||
}
|
||||
|
||||
@@ -5,17 +5,47 @@ export interface CacheModuleOptions extends CacheManagerOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface describing a `CacheOptionsFactory`. Providers supplying configuration
|
||||
* options for the Cache module must implement this interface.
|
||||
*
|
||||
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CacheOptionsFactory {
|
||||
createCacheOptions(): Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for dynamically configuring the Cache module.
|
||||
*
|
||||
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CacheModuleAsyncOptions
|
||||
extends Pick<ModuleMetadata, 'imports'> {
|
||||
/**
|
||||
* Injection token resolving to an existing provider. The provider must implement
|
||||
* the `CacheOptionsFactory` interface.
|
||||
*/
|
||||
useExisting?: Type<CacheOptionsFactory>;
|
||||
/**
|
||||
* Injection token resolving to a class that will be instantiated as a provider.
|
||||
* The class must implement the `CacheOptionsFactory` interface.
|
||||
*/
|
||||
useClass?: Type<CacheOptionsFactory>;
|
||||
/**
|
||||
* Function returning options (or a Promise resolving to options) to configure the
|
||||
* cache module.
|
||||
*/
|
||||
useFactory?: (
|
||||
...args: any[]
|
||||
) => Promise<CacheModuleOptions> | CacheModuleOptions;
|
||||
/**
|
||||
* Dependencies that a Factory may inject.
|
||||
*/
|
||||
inject?: any[];
|
||||
extraProviders?: Provider[];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
/**
|
||||
* Binds parameter decorators to the method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
* Decorator that binds *parameter decorators* to the method that follows.
|
||||
*
|
||||
* Useful when the language doesn't provide a 'Parameter Decorator' feature
|
||||
* (i.e., vanilla JavaScript).
|
||||
*
|
||||
* @param decorators one or more parameter decorators (e.g., `Req()`)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Bind(...decorators: any[]): MethodDecorator {
|
||||
return <T>(
|
||||
|
||||
@@ -2,8 +2,21 @@ import { FILTER_CATCH_EXCEPTIONS } from '../../constants';
|
||||
import { Type } from '../../interfaces';
|
||||
|
||||
/**
|
||||
* Defines an exception filter. Takes set of exception types as arguments which have to be caught by this filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
* Decorator that marks a class as a Nest exception filter. An exception filter
|
||||
* handles exceptions thrown by or not handled by your application code.
|
||||
*
|
||||
* The decorated class must implement the `ExceptionFilter` interface.
|
||||
*
|
||||
* @param exceptions one or more exception *types* specifying
|
||||
* the exceptions to be caught and handled by this filter.
|
||||
*
|
||||
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
|
||||
*
|
||||
* @usageNotes
|
||||
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
|
||||
* with `app.useGlobalFilters()`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Catch(...exceptions: Type<any>[]): ClassDecorator {
|
||||
return (target: object) => {
|
||||
|
||||
@@ -2,17 +2,127 @@ import { PATH_METADATA, SCOPE_OPTIONS_METADATA } from '../../constants';
|
||||
import { isString, isUndefined } from '../../utils/shared.utils';
|
||||
import { ScopeOptions } from './../../interfaces/scope-options.interface';
|
||||
|
||||
/**
|
||||
* Interface defining options that can be passed to `@Controller()` decorator
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ControllerOptions extends ScopeOptions {
|
||||
/**
|
||||
* Specifies an optional `route path prefix`. The prefix is pre-pended to the
|
||||
* path specified in any request decorator in the class.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*/
|
||||
path?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the controller. Controller can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
* Decorator that marks a class as a Nest controller that can receive inbound
|
||||
* requests and produce responses.
|
||||
*
|
||||
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
||||
* It defines a class that provides the context for one or more related route
|
||||
* handlers that correspond to HTTP request methods and associated routes
|
||||
* for example `GET /api/profile`, `POST /user/resume`.
|
||||
*
|
||||
* A Microservice Controller responds to requests as well as events, running over
|
||||
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
||||
* It defines a class that provides a context for one or more message or event
|
||||
* handlers.
|
||||
*
|
||||
* @see [Controllers](https://docs.nestjs.com/controllers)
|
||||
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Controller();
|
||||
|
||||
/**
|
||||
* Decorator that marks a class as a Nest controller that can receive inbound
|
||||
* requests and produce responses.
|
||||
*
|
||||
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
||||
* It defines a class that provides the context for one or more related route
|
||||
* handlers that correspond to HTTP request methods and associated routes
|
||||
* for example `GET /api/profile`, `POST /user/resume`.
|
||||
*
|
||||
* A Microservice Controller responds to requests as well as events, running over
|
||||
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
||||
* It defines a class that provides a context for one or more message or event
|
||||
* handlers.
|
||||
*
|
||||
* @param {string} prefix string that defines a `route path prefix`. The prefix
|
||||
* is pre-pended to the path specified in any request decorator in the class.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
* @see [Controllers](https://docs.nestjs.com/controllers)
|
||||
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Controller(prefix: string);
|
||||
|
||||
/**
|
||||
* Decorator that marks a class as a Nest controller that can receive inbound
|
||||
* requests and produce responses.
|
||||
*
|
||||
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
||||
* It defines a class that provides the context for one or more related route
|
||||
* handlers that correspond to HTTP request methods and associated routes
|
||||
* for example `GET /api/profile`, `POST /user/resume`.
|
||||
*
|
||||
* A Microservice Controller responds to requests as well as events, running over
|
||||
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
||||
* It defines a class that provides a context for one or more message or event
|
||||
* handlers.
|
||||
*
|
||||
* @param {object} options configuration object specifying:
|
||||
*
|
||||
* - `scope` - symbol that determines the lifetime of a Controller instance.
|
||||
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
|
||||
* more details.
|
||||
* - `prefix` - string that defines a `route path prefix`. The prefix
|
||||
* is pre-pended to the path specified in any request decorator in the class.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
* @see [Controllers](https://docs.nestjs.com/controllers)
|
||||
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Controller(options: ControllerOptions);
|
||||
|
||||
/**
|
||||
* Decorator that marks a class as a Nest controller that can receive inbound
|
||||
* requests and produce responses.
|
||||
*
|
||||
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
||||
* It defines a class that provides the context for one or more related route
|
||||
* handlers that correspond to HTTP request methods and associated routes
|
||||
* for example `GET /api/profile`, `POST /user/resume`
|
||||
*
|
||||
* A Microservice Controller responds to requests as well as events, running over
|
||||
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
||||
* It defines a class that provides a context for one or more message or event
|
||||
* handlers.
|
||||
*
|
||||
* @param prefixOrOptions a `route path prefix` or a `ControllerOptions` object.
|
||||
* A `route path prefix` is pre-pended to the path specified in any request decorator
|
||||
* in the class. `ControllerOptions` is an options configuration object specifying:
|
||||
* - `scope` - symbol that determines the lifetime of a Controller instance.
|
||||
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
|
||||
* more details.
|
||||
* - `prefix` - string that defines a `route path prefix`. The prefix
|
||||
* is pre-pended to the path specified in any request decorator in the class.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
* @see [Controllers](https://docs.nestjs.com/controllers)
|
||||
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
||||
* @see [Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Controller(): ClassDecorator;
|
||||
export function Controller(prefix: string): ClassDecorator;
|
||||
export function Controller(options: ControllerOptions): ClassDecorator;
|
||||
export function Controller(
|
||||
prefixOrOptions?: string | ControllerOptions,
|
||||
): ClassDecorator {
|
||||
@@ -20,8 +130,8 @@ export function Controller(
|
||||
const [path, scopeOptions] = isUndefined(prefixOrOptions)
|
||||
? [defaultPath, undefined]
|
||||
: isString(prefixOrOptions)
|
||||
? [prefixOrOptions, undefined]
|
||||
: [prefixOrOptions.path || defaultPath, { scope: prefixOrOptions.scope }];
|
||||
? [prefixOrOptions, undefined]
|
||||
: [prefixOrOptions.path || defaultPath, { scope: prefixOrOptions.scope }];
|
||||
|
||||
return (target: object) => {
|
||||
Reflect.defineMetadata(PATH_METADATA, path, target);
|
||||
|
||||
@@ -34,14 +34,26 @@ const defineFiltersMetadata = (...filters: (Function | ExceptionFilter)[]) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Bounds exception filters to the chosen context.
|
||||
* When the `@UseFilters()` is used on the controller level:
|
||||
* - Exception Filter will be set up to every handler (every method)
|
||||
* Decorator that binds exception filters to the scope of the controller or
|
||||
* method, depending on its context.
|
||||
*
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to the specified method
|
||||
* When `@UseFilters` is used at the controller level, the filter will be
|
||||
* applied to every handler (method) in the controller.
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
* When `@UseFilters` is used at the individual handler level, the filter
|
||||
* will apply only to that specific method.
|
||||
*
|
||||
* @param filters exception filter instance or class, or a list of exception
|
||||
* filter instances or classes.
|
||||
*
|
||||
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
|
||||
*
|
||||
* @usageNotes
|
||||
* Exception filters can also be set up globally for all controllers and routes
|
||||
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
|
||||
export const UseFilters = (...filters: (ExceptionFilter | Function)[]) =>
|
||||
defineFiltersMetadata(...filters);
|
||||
|
||||
@@ -5,8 +5,33 @@ import {
|
||||
import { isFunction, isUndefined } from '../../utils/shared.utils';
|
||||
|
||||
/**
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by either types or tokens.
|
||||
* Decorator that marks a constructor parameter as a target for
|
||||
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
|
||||
*
|
||||
* Any injected provider must be visible within the module scope (loosely
|
||||
* speaking, the containing module) of the class it is being injected into. This
|
||||
* can be done by:
|
||||
*
|
||||
* - defining the provider in the same module scope
|
||||
* - exporting the provider from one module scope and importing that module into the
|
||||
* module scope of the class being injected into
|
||||
* - exporting the provider from a module that is marked as global using the
|
||||
* `@Global()` decorator
|
||||
*
|
||||
* #### Injection tokens
|
||||
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
|
||||
* provider with which it is associated was defined. Providers defined with the
|
||||
* `@Injectable()` decorator use the class name. Custom Providers may use strings
|
||||
* or symbols as the injection token.
|
||||
*
|
||||
* @param token lookup key for the provider to be injected (assigned to the constructor
|
||||
* parameter).
|
||||
*
|
||||
* @see [Providers](https://docs.nestjs.com/providers)
|
||||
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
|
||||
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Inject<T = any>(token?: T) {
|
||||
return (target: Object, key: string | symbol, index?: number) => {
|
||||
|
||||
@@ -3,11 +3,42 @@ import { ScopeOptions } from '../../interfaces/scope-options.interface';
|
||||
import { SCOPE_OPTIONS_METADATA } from './../../constants';
|
||||
import { Type } from './../../interfaces/type.interface';
|
||||
|
||||
/**
|
||||
* Defines the injection scope.
|
||||
*
|
||||
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface InjectableOptions extends ScopeOptions {}
|
||||
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
* Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
|
||||
* Providers can be injected into other classes via constructor parameter injection
|
||||
* using Nest's built-in [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection)
|
||||
* system.
|
||||
*
|
||||
* When injecting a provider, it must be visible within the module scope (loosely
|
||||
* speaking, the containing module) of the class it is being injected into. This
|
||||
* can be done by:
|
||||
*
|
||||
* - defining the provider in the same module scope
|
||||
* - exporting the provider from one module scope and importing that module into the
|
||||
* module scope of the class being injected into
|
||||
* - exporting the provider from a module that is marked as global using the
|
||||
* `@Global()` decorator
|
||||
*
|
||||
* Providers can also be defined in a more explicit and imperative form using
|
||||
* various [custom provider](https://docs.nestjs.com/fundamentals/custom-providers) techniques that expose
|
||||
* more capabilities of the DI system.
|
||||
*
|
||||
* @param options options specifying scope of injectable
|
||||
*
|
||||
* @see [Providers](https://docs.nestjs.com/providers)
|
||||
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
|
||||
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Injectable(options?: InjectableOptions): ClassDecorator {
|
||||
return (target: object) => {
|
||||
|
||||
@@ -5,7 +5,17 @@ import {
|
||||
import { isUndefined } from '../../utils/shared.utils';
|
||||
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
* Parameter decorator for an injected dependency marking the
|
||||
* dependency as optional.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
|
||||
* ```
|
||||
*
|
||||
* @see [Optional providers](https://docs.nestjs.com/providers#optional-providers)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Optional() {
|
||||
return (target: Object, key: string | symbol, index?: number) => {
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
import { Logger } from './../../services/logger.service';
|
||||
|
||||
/**
|
||||
* Assigns the metadata to the class/function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
* Decorator that assigns metadata to the class/function using the
|
||||
* specified `key`.
|
||||
*
|
||||
* Requires two parameters:
|
||||
* - `key` - a value defining the key under which the metadata is stored
|
||||
* - `value[]` - array of metadata values to be associated with `key`
|
||||
*
|
||||
* This metadata can be reflected using the `Reflector` class.
|
||||
*
|
||||
* Example: `@SetMetadata('roles', ['admin'])`
|
||||
*
|
||||
* @see [Reflection](https://docs.nestjs.com/guards#reflection)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const SetMetadata = <K = any, V = any>(
|
||||
metadataKey: K,
|
||||
|
||||
@@ -5,14 +5,25 @@ import { isFunction } from '../../utils/shared.utils';
|
||||
import { validateEach } from '../../utils/validate-each.util';
|
||||
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
* Decorator that binds guards to the scope of the controller or method,
|
||||
* depending on its context.
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to the specified method
|
||||
* When `@UseGuards` is used at the controller level, the guard will be
|
||||
* applied to every handler (method) in the controller.
|
||||
*
|
||||
* @param {} ...guards
|
||||
* When `@UseGuards` is used at the individual handler level, the guard
|
||||
* will apply only to that specific method.
|
||||
*
|
||||
* @param guards a single guard instance or class, or a list of guard instances
|
||||
* or classes.
|
||||
*
|
||||
* @see [Guards](https://docs.nestjs.com/guards)
|
||||
*
|
||||
* @usageNotes
|
||||
* Guards can also be set up globally for all controllers and routes
|
||||
* using `app.useGlobalGuards()`. [See here for details](https://docs.nestjs.com/guards#binding-guards)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function UseGuards(...guards: (CanActivate | Function)[]) {
|
||||
return (target: any, key?: string, descriptor?: any) => {
|
||||
|
||||
@@ -5,14 +5,25 @@ import { isFunction } from '../../utils/shared.utils';
|
||||
import { validateEach } from '../../utils/validate-each.util';
|
||||
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
* Decorator that binds interceptors to the scope of the controller or method,
|
||||
* depending on its context.
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to the specified method
|
||||
* When `@UseInterceptors` is used at the controller level, the interceptor will
|
||||
* be applied to every handler (method) in the controller.
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
* When `@UseInterceptors` is used at the individual handler level, the interceptor
|
||||
* will apply only to that specific method.
|
||||
*
|
||||
* @param interceptors a single interceptor instance or class, or a list of
|
||||
* interceptor instances or classes.
|
||||
*
|
||||
* @see [Interceptors](https://docs.nestjs.com/interceptors)
|
||||
*
|
||||
* @usageNotes
|
||||
* Interceptors can also be set up globally for all controllers and routes
|
||||
* using `app.useGlobalInterceptors()`. [See here for details](https://docs.nestjs.com/interceptors#binding-interceptors)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function UseInterceptors(
|
||||
...interceptors: (NestInterceptor | Function)[]
|
||||
|
||||
@@ -5,15 +5,27 @@ import { isFunction } from '../../utils/shared.utils';
|
||||
import { validateEach } from '../../utils/validate-each.util';
|
||||
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
* Decorator that binds pipes to the scope of the controller or method,
|
||||
* depending on its context.
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to the specified method
|
||||
* When `@UsePipes` is used at the controller level, the pipe will be
|
||||
* applied to every handler (method) in the controller.
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
* When `@UsePipes` is used at the individual handler level, the pipe
|
||||
* will apply only to that specific method.
|
||||
*
|
||||
* @param pipes a single pipe instance or class, or a list of pipe instances or
|
||||
* classes.
|
||||
*
|
||||
* @see [Pipes](https://docs.nestjs.com/pipes)
|
||||
*
|
||||
* @usageNotes
|
||||
* Pipes can also be set up globally for all controllers and routes
|
||||
* using `app.useGlobalPipes()`. [See here for details](https://docs.nestjs.com/pipes#class-validator)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
|
||||
export function UsePipes(...pipes: (PipeTransform | Function)[]) {
|
||||
return (target: any, key?: string, descriptor?: any) => {
|
||||
const isPipeValid = <T extends Function | Record<string, any>>(pipe: T) =>
|
||||
|
||||
@@ -30,6 +30,7 @@ export type ParamDecoratorEnhancer = ParameterDecorator;
|
||||
|
||||
/**
|
||||
* Defines HTTP route param decorator
|
||||
*
|
||||
* @param factory
|
||||
*/
|
||||
export function createParamDecorator(
|
||||
@@ -48,7 +49,9 @@ export function createParamDecorator(
|
||||
|
||||
const isPipe = (pipe: any) =>
|
||||
pipe &&
|
||||
((isFunction(pipe) && pipe.prototype && isFunction(pipe.prototype.transform)) ||
|
||||
((isFunction(pipe) &&
|
||||
pipe.prototype &&
|
||||
isFunction(pipe.prototype.transform)) ||
|
||||
isFunction(pipe.transform));
|
||||
|
||||
const hasParamData = isNil(data) || !isPipe(data);
|
||||
|
||||
@@ -2,7 +2,17 @@ import { HEADERS_METADATA } from '../../constants';
|
||||
import { extendArrayMetadata } from '../../utils/extend-metadata.util';
|
||||
|
||||
/**
|
||||
* Sets a response header.
|
||||
* Request method Decorator. Sets a response header.
|
||||
*
|
||||
* For example:
|
||||
* `@Header('Cache-Control', 'none')`
|
||||
*
|
||||
* @param name string to be used for header name
|
||||
* @param value string to be used for header value
|
||||
*
|
||||
* @see [Headers](https://docs.nestjs.com/controllers#headers)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Header(name: string, value: string): MethodDecorator {
|
||||
return (target: object, key, descriptor) => {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { HTTP_CODE_METADATA } from '../../constants';
|
||||
|
||||
/**
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
* Request method Decorator. Defines the HTTP response status code. Overrides
|
||||
* default status code for the decorated request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
* @param statusCode HTTP response code to be returned by route handler.
|
||||
*
|
||||
* @see [Http Status Codes](https://docs.nestjs.com/controllers#status-code)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function HttpCode(statusCode: number): MethodDecorator {
|
||||
return (target: object, key, descriptor) => {
|
||||
|
||||
@@ -3,4 +3,5 @@ export * from './route-params.decorator';
|
||||
export * from './http-code.decorator';
|
||||
export * from './create-route-param-metadata.decorator';
|
||||
export * from './render.decorator';
|
||||
export * from './header.decorator';
|
||||
export * from './header.decorator';
|
||||
export * from './redirect.decorator';
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import { REDIRECT_METADATA } from '../../constants';
|
||||
|
||||
/**
|
||||
* Redirects request.
|
||||
* Redirects request to the specified URL.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Redirect(url: string): MethodDecorator {
|
||||
export function Redirect(url: string, statusCode?: number): MethodDecorator {
|
||||
return (target: object, key, descriptor) => {
|
||||
Reflect.defineMetadata(REDIRECT_METADATA, url, descriptor.value);
|
||||
Reflect.defineMetadata(
|
||||
REDIRECT_METADATA,
|
||||
{ statusCode, url },
|
||||
descriptor.value,
|
||||
);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { RENDER_METADATA } from '../../constants';
|
||||
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
* Route handler method Decorator. Defines a template to be rendered by the controller.
|
||||
*
|
||||
* For example: `@Render('index')`
|
||||
*
|
||||
* @param template name of the render engine template file
|
||||
*
|
||||
* @see [Model-View-Controller](https://docs.nestjs.com/techniques.mvc)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Render(template: string): MethodDecorator {
|
||||
return (target: object, key, descriptor) => {
|
||||
|
||||
@@ -31,41 +31,73 @@ const createMappingDecorator = (method: RequestMethod) => (
|
||||
};
|
||||
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Post = createMappingDecorator(RequestMethod.POST);
|
||||
|
||||
/**
|
||||
* Routes HTTP GET requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Get = createMappingDecorator(RequestMethod.GET);
|
||||
|
||||
/**
|
||||
* Routes HTTP DELETE requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Delete = createMappingDecorator(RequestMethod.DELETE);
|
||||
|
||||
/**
|
||||
* Routes HTTP PUT requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Put = createMappingDecorator(RequestMethod.PUT);
|
||||
|
||||
/**
|
||||
* Routes HTTP PATCH requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Patch = createMappingDecorator(RequestMethod.PATCH);
|
||||
|
||||
/**
|
||||
* Routes HTTP OPTIONS requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Options = createMappingDecorator(RequestMethod.OPTIONS);
|
||||
|
||||
/**
|
||||
* Routes HTTP HEAD requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Head = createMappingDecorator(RequestMethod.HEAD);
|
||||
|
||||
/**
|
||||
* Routes all HTTP requests to the specified path.
|
||||
* Route handler (method) Decorator. Routes all HTTP requests to the specified path.
|
||||
*
|
||||
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const All = createMappingDecorator(RequestMethod.ALL);
|
||||
|
||||
@@ -58,36 +58,198 @@ const createPipesRouteParamDecorator = (paramtype: RouteParamtypes) => (
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `Request`
|
||||
* object from the underlying platform and populates the decorated
|
||||
* parameter with the value of `Request`.
|
||||
*
|
||||
* Example: `logout(@Request() req)`
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Request: () => ParameterDecorator = createRouteParamDecorator(
|
||||
RouteParamtypes.REQUEST,
|
||||
);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `Response`
|
||||
* object from the underlying platform and populates the decorated
|
||||
* parameter with the value of `Response`.
|
||||
*
|
||||
* Example: `logout(@Response() res)`
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Response: () => ParameterDecorator = createRouteParamDecorator(
|
||||
RouteParamtypes.RESPONSE,
|
||||
);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts reference to the `Next` function
|
||||
* from the underlying platform and populates the decorated
|
||||
* parameter with the value of `Next`.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Next: () => ParameterDecorator = createRouteParamDecorator(
|
||||
RouteParamtypes.NEXT,
|
||||
);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `Session` object
|
||||
* from the underlying platform and populates the decorated
|
||||
* parameter with the value of `Session`.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Session: () => ParameterDecorator = createRouteParamDecorator(
|
||||
RouteParamtypes.SESSION,
|
||||
);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `file` object
|
||||
* and populates the decorated parameter with the value of `file`.
|
||||
* Used in conjunction with
|
||||
* [multer middleware](https://github.com/expressjs/multer).
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* uploadFile(@UploadedFile() file) {
|
||||
* console.log(file);
|
||||
* }
|
||||
* ```
|
||||
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const UploadedFile: (
|
||||
fileKey?: string,
|
||||
) => ParameterDecorator = createRouteParamDecorator(RouteParamtypes.FILE);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `files` object
|
||||
* and populates the decorated parameter with the value of `files`.
|
||||
* Used in conjunction with
|
||||
* [multer middleware](https://github.com/expressjs/multer).
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* uploadFile(@UploadedFiles() files) {
|
||||
* console.log(files);
|
||||
* }
|
||||
* ```
|
||||
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const UploadedFiles: () => ParameterDecorator = createRouteParamDecorator(
|
||||
RouteParamtypes.FILES,
|
||||
);
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `headers`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `headers`.
|
||||
*
|
||||
* For example: `async update(@Headers('Cache-Control') cacheControl: string)`
|
||||
*
|
||||
* @param property name of single header property to extract.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const Headers: (
|
||||
property?: string,
|
||||
) => ParameterDecorator = createRouteParamDecorator(RouteParamtypes.HEADERS);
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `query`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `query`. May also apply pipes to the bound
|
||||
* query parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async find(@Query('user') user: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `query` object
|
||||
* @param pipes one or more pipes to apply to the bound query parameter
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Query(): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `query`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `query`. May also apply pipes to the bound
|
||||
* query parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async find(@Query('user') user: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `query` object
|
||||
* @param pipes one or more pipes to apply to the bound query parameter
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Query(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `query`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `query`. May also apply pipes to the bound
|
||||
* query parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async find(@Query('user') user: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `query` object
|
||||
* @param pipes one or more pipes to apply to the bound query parameter
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Query(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `query`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `query`. May also apply pipes to the bound
|
||||
* query parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async find(@Query('user') user: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `query` object
|
||||
* @param pipes one or more pipes to apply to the bound query parameter
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Query(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
@@ -98,14 +260,90 @@ export function Query(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the entire `body`
|
||||
* object from the `req` object and populates the decorated
|
||||
* parameter with the value of `body`.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async create(@Body() cat: CreateCatDto)
|
||||
* ```
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Body(): ParameterDecorator;
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the entire `body`
|
||||
* object from the `req` object and populates the decorated
|
||||
* parameter with the value of `body`. Also applies the specified
|
||||
* pipes to that parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async create(@Body(new ValidationPipe()) cat: CreateCatDto)
|
||||
* ```
|
||||
*
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound body parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Body(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts a single property from
|
||||
* the `body` object property of the `req` object and populates the decorated
|
||||
* parameter with the value of that property. Also applies pipes to the bound
|
||||
* body parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async create(@Body('role', new ValidationPipe()) role: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `body` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound body parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Body(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the entire `body` object
|
||||
* property, or optionally a named property of the `body` object, from
|
||||
* the `req` object and populates the decorated parameter with that value.
|
||||
* Also applies pipes to the bound body parameter.
|
||||
*
|
||||
* For example:
|
||||
* ```typescript
|
||||
* async create(@Body('role', new ValidationPipe()) role: string)
|
||||
* ```
|
||||
*
|
||||
* @param property name of single property to extract from the `body` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound body parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Body(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
@@ -116,14 +354,110 @@ export function Body(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `params`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `params`. May also apply pipes to the bound
|
||||
* parameter.
|
||||
*
|
||||
* For example, extracting all params:
|
||||
* ```typescript
|
||||
* findOne(@Param() params: string[])
|
||||
* ```
|
||||
*
|
||||
* For example, extracting a single param:
|
||||
* ```typescript
|
||||
* findOne(@Param('id') id: string)
|
||||
* ```
|
||||
* @param property name of single property to extract from the `req` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Param(): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `params`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `params`. May also apply pipes to the bound
|
||||
* parameter.
|
||||
*
|
||||
* For example, extracting all params:
|
||||
* ```typescript
|
||||
* findOne(@Param() params: string[])
|
||||
* ```
|
||||
*
|
||||
* For example, extracting a single param:
|
||||
* ```typescript
|
||||
* findOne(@Param('id') id: string)
|
||||
* ```
|
||||
* @param property name of single property to extract from the `req` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Param(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `params`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `params`. May also apply pipes to the bound
|
||||
* parameter.
|
||||
*
|
||||
* For example, extracting all params:
|
||||
* ```typescript
|
||||
* findOne(@Param() params: string[])
|
||||
* ```
|
||||
*
|
||||
* For example, extracting a single param:
|
||||
* ```typescript
|
||||
* findOne(@Param('id') id: string)
|
||||
* ```
|
||||
* @param property name of single property to extract from the `req` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Param(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
/**
|
||||
* Route handler parameter decorator. Extracts the `params`
|
||||
* property from the `req` object and populates the decorated
|
||||
* parameter with the value of `params`. May also apply pipes to the bound
|
||||
* parameter.
|
||||
*
|
||||
* For example, extracting all params:
|
||||
* ```typescript
|
||||
* findOne(@Param() params: string[])
|
||||
* ```
|
||||
*
|
||||
* For example, extracting a single param:
|
||||
* ```typescript
|
||||
* findOne(@Param('id') id: string)
|
||||
* ```
|
||||
* @param property name of single property to extract from the `req` object
|
||||
* @param pipes one or more pipes - either instances or classes - to apply to
|
||||
* the bound parameter.
|
||||
*
|
||||
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
||||
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Param(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import { GLOBAL_MODULE_METADATA } from '../../constants';
|
||||
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
* Decorator that makes a module global-scoped.
|
||||
*
|
||||
* Once imported into any module, a global-scoped module will be visible
|
||||
* in all modules. Thereafter, modules that wish to inject a service exported
|
||||
* from a global module do not need to import the provider module.
|
||||
*
|
||||
* @see [Global modules](https://docs.nestjs.com/modules#global-modules)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Global(): ClassDecorator {
|
||||
return (target: any) => {
|
||||
|
||||
@@ -21,12 +21,18 @@ const validateKeys = (keys: string[]) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* @param metadata {ModuleMetadata} Module metadata
|
||||
* Decorator that marks a class as a [module](https://docs.nestjs.com/modules).
|
||||
*
|
||||
* Modules are used by Nest to organize the application structure into scopes. Controllers
|
||||
* and Providers are scoped by the module they are declared in. Modules and their
|
||||
* classes (Controllers and Providers) form a graph that determines how Nest
|
||||
* performs [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
|
||||
*
|
||||
* @param metadata module configuration metadata
|
||||
*
|
||||
* @see [Modules](https://docs.nestjs.com/modules)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export function Module(metadata: ModuleMetadata): ClassDecorator {
|
||||
const propsKeys = Object.keys(metadata);
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Bad Gateway* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class BadGatewayException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `BadGatewayException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new BadGatewayException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Bad Gateway') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.BAD_GATEWAY),
|
||||
HttpException.createBody(message, error, HttpStatus.BAD_GATEWAY),
|
||||
HttpStatus.BAD_GATEWAY,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Bad Request* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class BadRequestException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `BadRequestException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new BadRequestException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Bad Request'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Bad Request') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.BAD_REQUEST),
|
||||
HttpException.createBody(message, error, HttpStatus.BAD_REQUEST),
|
||||
HttpStatus.BAD_REQUEST,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Conflict* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class ConflictException extends HttpException {
|
||||
constructor(message?: string | object | any, error = 'Conflict') {
|
||||
/**
|
||||
* Instantiate a `ConflictException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new ConflictException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Conflict'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/ constructor(message?: string | object | any, error = 'Conflict') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.CONFLICT),
|
||||
HttpException.createBody(message, error, HttpStatus.CONFLICT),
|
||||
HttpStatus.CONFLICT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Forbidden* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class ForbiddenException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `ForbiddenException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new ForbiddenException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Forbidden'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Forbidden') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.FORBIDDEN),
|
||||
HttpException.createBody(message, error, HttpStatus.FORBIDDEN),
|
||||
HttpStatus.FORBIDDEN,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Gatway Timeout* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class GatewayTimeoutException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `GatewayTimeoutException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new GatewayTimeoutException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Gateway Timeout'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Gateway Timeout') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
|
||||
HttpException.createBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
|
||||
HttpStatus.GATEWAY_TIMEOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Gone* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class GoneException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `GoneException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new GoneException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Gone'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Gone') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.GONE),
|
||||
HttpException.createBody(message, error, HttpStatus.GONE),
|
||||
HttpStatus.GONE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
import { isString } from '../utils/shared.utils';
|
||||
import { isString, isObject } from '../utils/shared.utils';
|
||||
|
||||
/**
|
||||
* Defines the base Nest HTTP exception, which is handled by the default
|
||||
* Exceptions Handler.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class HttpException extends Error {
|
||||
public readonly message: any;
|
||||
|
||||
/**
|
||||
* Base Nest application exception, which is handled by the default Exceptions Handler.
|
||||
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
* Instantiate a plain HTTP Exception.
|
||||
*
|
||||
* When `response` is an object:
|
||||
* - object will be stringified and returned to the user as a JSON response,
|
||||
* @example
|
||||
* `throw new HttpException()`
|
||||
*
|
||||
* When `response` is a string:
|
||||
* - Nest will create a response with two properties:
|
||||
* ```
|
||||
* message: response,
|
||||
* statusCode: X
|
||||
* ```
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `response` argument (required) defines the JSON response body.
|
||||
* - The `status` argument (required) defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: a short description of the HTTP error by default; override this
|
||||
* by supplying a string in the `response` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `status` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param response string or object describing the error condition.
|
||||
* @param status HTTP response status code
|
||||
*/
|
||||
constructor(
|
||||
private readonly response: string | object,
|
||||
@@ -41,4 +59,17 @@ export class HttpException extends Error {
|
||||
private getErrorString(target: string | object): string {
|
||||
return isString(target) ? target : JSON.stringify(target);
|
||||
}
|
||||
|
||||
public static createBody = (
|
||||
message: object | string,
|
||||
error?: string,
|
||||
statusCode?: number,
|
||||
) => {
|
||||
if (!message) {
|
||||
return { statusCode, error };
|
||||
}
|
||||
return isObject(message) && !Array.isArray(message)
|
||||
? message
|
||||
: { statusCode, error, message };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,45 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
import { HttpException } from './http.exception';
|
||||
|
||||
/**
|
||||
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot".
|
||||
* The resulting entity body MAY be short and stout.
|
||||
* Defines an HTTP exception for *ImATeapotException* type errors.
|
||||
*
|
||||
* http://save418.com/
|
||||
* Any attempt to brew coffee with a teapot should result in the error code
|
||||
* "418 I'm a teapot". The resulting entity body MAY be short and stout.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class ImATeapotException extends HttpException {
|
||||
/**
|
||||
* Instantiate an `ImATeapotException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new BadGatewayException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `"I'm a Teapot"` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'I\'m a teapot') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.I_AM_A_TEAPOT),
|
||||
HttpException.createBody(message, error, HttpStatus.I_AM_A_TEAPOT),
|
||||
HttpStatus.I_AM_A_TEAPOT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,45 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Internal Server Error* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class InternalServerErrorException extends HttpException {
|
||||
/**
|
||||
* Instantiate an `InternalServerErrorException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new InternalServerErrorException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Internal Server Error'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(
|
||||
message?: string | object | any,
|
||||
error = 'Internal Server Error',
|
||||
) {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
|
||||
HttpException.createBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Method Not Allowed* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class MethodNotAllowedException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `MethodNotAllowedException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new MethodNotAllowedException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Method Not Allowed'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Method Not Allowed') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
|
||||
HttpException.createBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
|
||||
HttpStatus.METHOD_NOT_ALLOWED,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Not Acceptable* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class NotAcceptableException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `NotAcceptableException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new NotAcceptableException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Not Acceptable') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.NOT_ACCEPTABLE),
|
||||
HttpException.createBody(message, error, HttpStatus.NOT_ACCEPTABLE),
|
||||
HttpStatus.NOT_ACCEPTABLE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Not Found* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class NotFoundException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `NotFoundException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new NotFoundException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Not Found'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Not Found') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.NOT_FOUND),
|
||||
HttpException.createBody(message, error, HttpStatus.NOT_FOUND),
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Not Implemented* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class NotImplementedException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `NotImplementedException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new NotImplementedException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Not Implemented'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Not Implemented') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.NOT_IMPLEMENTED),
|
||||
HttpException.createBody(message, error, HttpStatus.NOT_IMPLEMENTED),
|
||||
HttpStatus.NOT_IMPLEMENTED,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Payload Too Large* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class PayloadTooLargeException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `PayloadTooLargeException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new PayloadTooLargeException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Payload Too Large'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Payload Too Large') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
|
||||
HttpException.createBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
|
||||
HttpStatus.PAYLOAD_TOO_LARGE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Request Timeout* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class RequestTimeoutException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `RequestTimeoutException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new RequestTimeoutException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Request Timeout'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Request Timeout') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.REQUEST_TIMEOUT),
|
||||
HttpException.createBody(message, error, HttpStatus.REQUEST_TIMEOUT),
|
||||
HttpStatus.REQUEST_TIMEOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Service Unavailable* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServiceUnavailableException extends HttpException {
|
||||
/**
|
||||
* Instnatiate a `ServiceUnavailableException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new ServiceUnavailableException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Service Unavailable'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Service Unavailable') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
|
||||
HttpException.createBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
|
||||
HttpStatus.SERVICE_UNAVAILABLE,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Unauthorized* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class UnauthorizedException extends HttpException {
|
||||
/**
|
||||
* Instantiate an `UnauthorizedException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new UnauthorizedException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Unauthorized'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Unauthorized') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.UNAUTHORIZED),
|
||||
HttpException.createBody(message, error, HttpStatus.UNAUTHORIZED),
|
||||
HttpStatus.UNAUTHORIZED,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,42 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Unprocessable Entity* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class UnprocessableEntityException extends HttpException {
|
||||
/**
|
||||
* Instantiate an `UnprocessableEntityException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new UnprocessableEntityException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Unprocessable Entity'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(message?: string | object | any, error = 'Unprocessable Entity') {
|
||||
super(
|
||||
createHttpExceptionBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
|
||||
HttpException.createBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
|
||||
HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,45 @@
|
||||
import { HttpException } from './http.exception';
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Unsupported Media Type* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class UnsupportedMediaTypeException extends HttpException {
|
||||
/**
|
||||
* Instantiate an `UnsupportedMediaTypeException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new UnsupportedMediaTypeException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The constructor arguments define the HTTP response.
|
||||
* - The `message` argument defines the JSON response body.
|
||||
* - The `error` argument defines the HTTP Status Code.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
|
||||
* - `message`: the string `'Unsupported Media Type'` by default; override this by supplying
|
||||
* a string in the `message` parameter.
|
||||
*
|
||||
* To override the entire JSON response body, pass an object. Nest will serialize
|
||||
* the object and return it as the JSON response body.
|
||||
*
|
||||
* The `error` argument is required, and should be a valid HTTP status code.
|
||||
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
|
||||
*
|
||||
* @param message string or object describing the error condition.
|
||||
* @param error HTTP response status code
|
||||
*/
|
||||
constructor(
|
||||
message?: string | object | any,
|
||||
error = 'Unsupported Media Type',
|
||||
) {
|
||||
super(
|
||||
createHttpExceptionBody(
|
||||
HttpException.createBody(
|
||||
message,
|
||||
error,
|
||||
HttpStatus.UNSUPPORTED_MEDIA_TYPE,
|
||||
|
||||
@@ -15,6 +15,7 @@ export {
|
||||
Abstract,
|
||||
ArgumentMetadata,
|
||||
ArgumentsHost,
|
||||
BeforeApplicationShutdown,
|
||||
CallHandler,
|
||||
CanActivate,
|
||||
DynamicModule,
|
||||
@@ -43,6 +44,7 @@ export {
|
||||
WebSocketAdapter,
|
||||
WsExceptionFilter,
|
||||
WsMessageHandler,
|
||||
ScopeOptions,
|
||||
} from './interfaces';
|
||||
export * from './pipes';
|
||||
export * from './serializer';
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface BeforeApplicationShutdown {
|
||||
beforeApplicationShutdown(signal?: string): any;
|
||||
}
|
||||
@@ -1,5 +1,19 @@
|
||||
import { ArgumentsHost } from '../features/arguments-host.interface';
|
||||
|
||||
/**
|
||||
* Interface describing implementation of an exception filter.
|
||||
*
|
||||
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ExceptionFilter<T = any> {
|
||||
/**
|
||||
* Method to implement a custom exception filter.
|
||||
*
|
||||
* @param exception the class of the exception being handled
|
||||
* @param host used to access an array of arguments for
|
||||
* the in-flight request
|
||||
*/
|
||||
catch(exception: T, host: ArgumentsHost): any;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { ArgumentsHost } from '../features/arguments-host.interface';
|
||||
|
||||
/**
|
||||
* Interface describing implementation of an RPC exception filter.
|
||||
*
|
||||
* @see [Exception Filters](https://docs.nestjs.com/microservices/exception-filters)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface RpcExceptionFilter<T = any, R = any> {
|
||||
/**
|
||||
* Method to implement a custom (microservice) exception filter.
|
||||
*
|
||||
* @param exception the type (class) of the exception being handled
|
||||
* @param host used to access an array of arguments for
|
||||
* the in-flight message
|
||||
*/
|
||||
catch(exception: T, host: ArgumentsHost): Observable<R>;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user