Compare commits

..

9 Commits

Author SHA1 Message Date
Kamil Myśliwiec
3c1a6a2f97 refactor() add whitespace to gulp config 2019-08-24 19:24:18 +02:00
Kamil Myśliwiec
09ce572d8f refactor(docs) small docs, comments fixes 2019-08-24 19:23:54 +02:00
Kamil Myśliwiec
3671a1b359 Merge branch 'feature/api-docs' of https://github.com/BrunnerLivio/nest into BrunnerLivio-feature/api-docs 2019-08-24 10:50:50 +02:00
Livio
738e00ebb0 lint(core): Remove trailing whitespace 2019-08-15 17:36:03 +02:00
John Biundo
9edd0444e5 feat(common): Add documentation for public API 2019-08-15 17:26:11 +02:00
John Biundo
b840b1974c feat(platform-express): Add documentation for public API 2019-08-15 17:25:27 +02:00
John Biundo
63262c38f6 feat(core): Add documentation for public API 2019-08-15 17:25:27 +02:00
Livio
e76786b1b1 feat(): Add package description files 2019-08-15 17:25:27 +02:00
Livio
68721a2539 feat(): Add ScopeOptions to public API
Mandatory so the public API parser
of docs.nestjs.com can compute this interface
2019-08-15 17:25:27 +02:00
285 changed files with 2326 additions and 5214 deletions

View File

@@ -1,160 +0,0 @@
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 Normal file
View File

@@ -0,0 +1,56 @@
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

View File

@@ -4,14 +4,13 @@ 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
@@ -25,8 +24,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.
@@ -45,10 +44,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
@@ -58,9 +57,9 @@ Before you submit an issue, please search the issue tracker, maybe an issue for
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
- version of NestJS used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
* version of NestJS used
* 3rd-party libraries and their versions
* and most importantly - a use-case that fails
<!--
// TODO we need to create a playground, similar to plunkr
@@ -115,11 +114,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
@@ -133,25 +132,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
@@ -178,9 +177,14 @@ 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 move to "sample" and "integration" directories
# build all packages and put them near to their source .ts files
$ npm run build
# build all packages and move to "sample" and "integration" directories
# if cross-packages breaking changes were performed you may face irrelevant errors
# in order to verify the build, you can run this command again then
$ npm run build:dev
# run the full unit tests suite
$ npm run test
@@ -190,9 +194,6 @@ $ 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
@@ -203,8 +204,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
@@ -248,15 +249,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
@@ -264,28 +265,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

View File

@@ -2,15 +2,18 @@
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</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://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://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://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>

View File

@@ -47,40 +47,26 @@
}
},
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/graphql": {
@@ -196,9 +182,9 @@
}
},
"@types/body-parser": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz",
"integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
@@ -224,9 +210,9 @@
}
},
"@types/cors": {
"version": "2.8.6",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.6.tgz",
"integrity": "sha512-invOmosX0DqbpA+cE2yoHGUlF/blyf7nB0OGYBBiH27crcVm5NmFaZkLP4Ta1hGaesckCi5lVLlydNJCxkTOSg==",
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-GmK8AKu8i+s+EChK/uZ5IbrXPcPaQKWaNSGevDT/7o3gFObwSUQwqb1jMqxuo+YPvj0ckGzINI+EO7EHcmJjKg==",
"requires": {
"@types/express": "*"
}
@@ -237,9 +223,9 @@
"integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g=="
},
"@types/express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.1.tgz",
"integrity": "sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w==",
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.0.tgz",
"integrity": "sha512-CjaMu57cjgjuZbh9DpkloeGxV45CnMGlVd+XpG7Gm9QgVrd7KFq+X4HY0vM+2v0bczS48Wg7bvnMY5TN+Xmcfw==",
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "*",
@@ -247,22 +233,14 @@
}
},
"@types/express-serve-static-core": {
"version": "4.16.9",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz",
"integrity": "sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ==",
"version": "4.16.7",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.7.tgz",
"integrity": "sha512-847KvL8Q1y3TtFLRTXcVakErLJQgdpFSaq+k043xefz9raEf0C7HalpSY7OW5PyjCnY8P7bPW5t/Co9qqp+USg==",
"requires": {
"@types/node": "*",
"@types/range-parser": "*"
}
},
"@types/fs-capacitor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz",
"integrity": "sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ==",
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
@@ -279,30 +257,19 @@
"integrity": "sha512-okXbUmdZFMO3AYBEJCcpJFPFDkKmIiZZBqWD5TmPtAv+GHfjD2qLZEI0PvZ8IWMU4ozoK2HV2lDxWjw4LbVlnw=="
},
"@types/graphql-upload": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.2.tgz",
"integrity": "sha512-7pfyXHmfa2W/hrM2Q++V7U7zdgSQj8i+wuuTV9FxOI0puKYcBB1GU2DMa/WPbnDPec/1CGWMIPVmhpzZ1ItVlA==",
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.0.tgz",
"integrity": "sha512-xeDYfZb0SeRpCRuivN9TXLEVsbG0F4inFtx03yadZeaTXr1kC224/ZvlV6NKqQ//HNvUxneYcEoUB5ugJc8dnA==",
"requires": {
"@types/express": "*",
"@types/fs-capacitor": "*",
"@types/koa": "*",
"graphql": "14.5.0"
},
"dependencies": {
"graphql": {
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
}
"@types/graphql": "*",
"@types/koa": "*"
}
},
"@types/http-assert": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz",
"integrity": "sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ=="
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.0.tgz",
"integrity": "sha512-8CBLG8RmxSvoY07FE6M/QpvJ7J5KzeKqF8eWN7Dq6Ks+lBTQae8Roc2G81lUu2Kw5Ju1gymOuvgyUsussbjAaA=="
},
"@types/keygrip": {
"version": "1.0.1",
@@ -362,19 +329,20 @@
"optional": true
},
"@types/serve-static": {
"version": "1.13.3",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz",
"integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==",
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==",
"requires": {
"@types/express-serve-static-core": "*",
"@types/mime": "*"
}
},
"@types/ws": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.3.tgz",
"integrity": "sha512-yBTM0P05Tx9iXGq00BbJPo37ox68R5vaGTXivs6RGh/BQ6QP5zqZDGWdAO6JbRE/iR1l80xeGAwCQS2nMV9S/w==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.1.tgz",
"integrity": "sha512-EzH8k1gyZ4xih/MaZTXwT2xOkPiIMSrhQ9b8wrlX88L0T02eYsddatQlwVFlEPyEqV0ChpdpNnE51QPH6NVT4Q==",
"requires": {
"@types/events": "*",
"@types/node": "*"
}
},
@@ -451,18 +419,6 @@
"apollo-server-types": "0.2.1",
"async-retry": "^1.2.1",
"graphql-extensions": "0.9.1"
},
"dependencies": {
"graphql-extensions": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
"apollo-server-types": "0.2.1"
}
}
}
},
"apollo-engine-reporting-protobuf": {
@@ -512,9 +468,9 @@
}
},
"apollo-server-core": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.9.0.tgz",
"integrity": "sha512-IvKIgqOqEEB8nszlpHWzlhAu4376So2PgNhFP6UrlfNTllt/WDti5YMOHnVimPWIDHmLPKFan0+wfzpsoRCRdg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.8.1.tgz",
"integrity": "sha512-BpvhKdycTI1v5n8biJ5c/DVF7MCbTL3JtB9llHGkqYgHaTH1gXguh2qD8Vcki+rpUNO5P1lcj5V6oVXoSUFXlA==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"@apollographql/graphql-playground-html": "1.6.24",
@@ -530,7 +486,7 @@
"apollo-server-types": "0.2.1",
"apollo-tracing": "0.8.1",
"fast-json-stable-stringify": "^2.0.0",
"graphql-extensions": "0.10.0",
"graphql-extensions": "0.9.1",
"graphql-tag": "^2.9.2",
"graphql-tools": "^4.0.0",
"graphql-upload": "^8.0.2",
@@ -564,23 +520,22 @@
"integrity": "sha512-errZvnh0vUQChecT7M4A/h94dnBSRL213dNxpM5ueMypaLYgnp4hiCTWIEaooo9E4yMGd1qA6WaNbLDG2+bjcg=="
},
"apollo-server-express": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.9.0.tgz",
"integrity": "sha512-+057V6Ui1BX69jUlV6YDQ7Xw9CCBfowN/GauvyF09KnsjYUJ+cB1xf4mkj/HAjaz4ReXQaALJNr2qPYPXS4R6w==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.8.1.tgz",
"integrity": "sha512-XoWqSuNQkL8ivBq5LXJW6wV0/Ef+m8w4fAK/7PBspLHVfDAbHRyRr6zraotim2Kl7NOnzcqHtb6sB9yozjL0hA==",
"requires": {
"@apollographql/graphql-playground-html": "1.6.24",
"@types/accepts": "^1.3.5",
"@types/body-parser": "1.17.1",
"@types/body-parser": "1.17.0",
"@types/cors": "^2.8.4",
"@types/express": "4.17.1",
"@types/express": "4.17.0",
"accepts": "^1.3.5",
"apollo-server-core": "2.9.0",
"apollo-server-core": "2.8.1",
"apollo-server-types": "0.2.1",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"graphql-subscriptions": "^1.0.0",
"graphql-tools": "^4.0.0",
"parseurl": "^1.3.2",
"subscriptions-transport-ws": "^0.9.16",
"type-is": "^1.6.16"
}
@@ -879,9 +834,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"content-type": {
"version": "1.0.4",
@@ -889,9 +844,9 @@
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"core-js": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz",
"integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw=="
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.1.4.tgz",
"integrity": "sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ=="
},
"cors": {
"version": "2.8.5",
@@ -1205,17 +1160,17 @@
"integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg=="
},
"graphql": {
"version": "14.5.3",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.3.tgz",
"integrity": "sha512-W8A8nt9BsMg0ZK2qA3DJIVU6muWhxZRYLTmc+5XGwzWzVdUdPVlAAg5hTBjiTISEnzsKL/onasu6vl3kgGTbYg==",
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
},
"graphql-extensions": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.10.0.tgz",
"integrity": "sha512-qz9Ev0NgsRxdTYqYSCpYwBWS9r1imm+vCBt3PmHzqZlE7SEpUPGddn9oKcLRB/P8uXT6dsr60hDmDHukIxiVOw==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
@@ -1687,11 +1642,6 @@
"resolved": "https://registry.npmjs.org/optional/-/optional-0.1.4.tgz",
"integrity": "sha512-gtvrrCfkE08wKcgXaVwQVgwEQ8vel2dc5DDBn9RLQZ3YtmtkBss6A2HY6BnJH4N/4Ku97Ri/SF8sNWE2225WJw=="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -1734,9 +1684,9 @@
},
"dependencies": {
"@types/node": {
"version": "10.14.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.16.tgz",
"integrity": "sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA=="
"version": "10.14.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz",
"integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ=="
}
}
},
@@ -2011,9 +1961,9 @@
}
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"type-graphql": {
"version": "0.17.4",

View File

@@ -9,11 +9,11 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/graphql": "6.4.2",
"apollo-server-express": "2.9.0",
"graphql": "14.5.3",
"apollo-server-express": "2.8.1",
"graphql": "14.5.0",
"graphql-tools": "4.0.5",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",

View File

@@ -1,59 +0,0 @@
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 of dependent modules first `, () => {
return request(app.getHttpServer())
.get('/hello')
.expect(200, RETURN_VALUE_A);
});
afterEach(async () => {
await app.close();
});
});

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/microservices": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.0.tgz",
"integrity": "sha512-OPUFsHNds0UGYWCLxH5SCZHfOvUh4m3pTVV8pdZKNqYPiyzwRku2lQZSTQCtnQmj4YMt4vL2WO6sfRqESkQkFw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.0.tgz",
"integrity": "sha512-Ulb+DbtRxh0Unl4egEJDMako/125MWNKyxQuQei5AJmF5rdVLZuy5KpoH/ymDHTx8s6YDGOin1dXQVZgbCFR/A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.0.tgz",
"integrity": "sha512-T+ARP0HZIQHadiyXMWe5ccoRbdNCAD20yM1ckVog9jaJmcD2XVQEqfgvUa8P1FO+LIK5pjNnSo1Ov3mXsK6EdA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"requires": {
"iterare": "1.2.0"
}
@@ -227,9 +227,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"cookiejar": {
"version": "2.1.2",
@@ -837,9 +837,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -860,9 +860,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/microservices": "6.6.0",
"@nestjs/testing": "6.6.0",
"@nestjs/websockets": "6.6.0",
"@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",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"fastify": "2.7.1",

View File

@@ -1,55 +0,0 @@
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,
);
});
});

View File

@@ -1,54 +0,0 @@
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);
});

View File

@@ -1,4 +1,5 @@
import { Test } from '@nestjs/testing';
import { expect } from 'chai';
import * as Sinon from 'sinon';
import {
Injectable,
@@ -6,7 +7,6 @@ import {
OnApplicationShutdown,
OnModuleDestroy,
OnModuleInit,
BeforeApplicationShutdown,
} from '@nestjs/common';
@Injectable()
@@ -15,10 +15,8 @@ class TestInjectable
OnApplicationBootstrap,
OnModuleInit,
OnModuleDestroy,
OnApplicationShutdown,
BeforeApplicationShutdown {
OnApplicationShutdown {
onApplicationBootstrap = Sinon.spy();
beforeApplicationShutdown = Sinon.spy();
onApplicationShutdown = Sinon.spy();
onModuleDestroy = Sinon.spy();
onModuleInit = Sinon.spy();
@@ -39,7 +37,6 @@ describe('Lifecycle Hook Order', () => {
instance.onModuleInit,
instance.onApplicationBootstrap,
instance.onModuleDestroy,
instance.beforeApplicationShutdown,
instance.onApplicationShutdown,
);
});

View File

@@ -19,26 +19,4 @@ 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);
});
});

View File

@@ -1,6 +1,8 @@
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()
@@ -19,4 +21,43 @@ 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);
});

View File

@@ -19,26 +19,4 @@ 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);
});
});

View File

@@ -19,26 +19,4 @@ 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);
});
});

View File

@@ -5,26 +5,26 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nuxtjs/opencollective": {
@@ -155,9 +155,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"cookiejar": {
"version": "2.1.2",
@@ -562,9 +562,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -578,9 +578,9 @@
"dev": true
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,8 +7,8 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -1,16 +1,12 @@
import { Injectable, OnApplicationShutdown, BeforeApplicationShutdown, Module } from '@nestjs/common';
import { Injectable, OnApplicationShutdown, 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, BeforeApplicationShutdown {
beforeApplicationShutdown(signal: string) {
console.log('beforeApplicationShutdown ' + signal);
}
class TestInjectable implements OnApplicationShutdown {
onApplicationShutdown(signal: string) {
console.log('onApplicationShutdown ' + signal);
console.log('Signal ' + signal);
}
}

View File

@@ -1,54 +0,0 @@
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);
}
});
});

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/microservices": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.0.tgz",
"integrity": "sha512-OPUFsHNds0UGYWCLxH5SCZHfOvUh4m3pTVV8pdZKNqYPiyzwRku2lQZSTQCtnQmj4YMt4vL2WO6sfRqESkQkFw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.0.tgz",
"integrity": "sha512-Ulb+DbtRxh0Unl4egEJDMako/125MWNKyxQuQei5AJmF5rdVLZuy5KpoH/ymDHTx8s6YDGOin1dXQVZgbCFR/A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.0.tgz",
"integrity": "sha512-T+ARP0HZIQHadiyXMWe5ccoRbdNCAD20yM1ckVog9jaJmcD2XVQEqfgvUa8P1FO+LIK5pjNnSo1Ov3mXsK6EdA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"requires": {
"iterare": "1.2.0"
}
@@ -181,9 +181,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"cookiejar": {
"version": "2.1.2",
@@ -593,9 +593,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -609,9 +609,9 @@
"dev": true
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/microservices": "6.6.0",
"@nestjs/testing": "6.6.0",
"@nestjs/websockets": "6.6.0",
"@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",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -1,7 +0,0 @@
import { Controller, Scope } from '@nestjs/common';
@Controller({
path: 'test',
scope: Scope.REQUEST,
})
export class ScopedController {}

View File

@@ -1,10 +0,0 @@
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 {}

View File

@@ -1,4 +0,0 @@
import { Injectable, Scope } from '@nestjs/common';
@Injectable({ scope: Scope.REQUEST })
export class ScopedService {}

View File

@@ -1,4 +0,0 @@
import { Injectable, Scope } from '@nestjs/common';
@Injectable({ scope: Scope.TRANSIENT })
export class TransientService {}

View File

@@ -18,15 +18,9 @@ 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();

View File

@@ -18,15 +18,9 @@ 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();

View File

@@ -18,15 +18,9 @@ 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();

View File

@@ -19,9 +19,6 @@ describe('MQTT transport', () => {
app.connectMicroservice({
transport: Transport.MQTT,
options: {
url: 'mqtt://0.0.0.0:1883',
},
});
await app.startAllMicroservicesAsync();
await app.init();
@@ -49,8 +46,6 @@ describe('MQTT transport', () => {
.expect(200, '15');
});
/**
* Figure out race conditions here (flaky tests)
it(`/POST (concurrent)`, function() {
this.retries(10);
return request(server)
@@ -68,7 +63,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)

View File

@@ -20,7 +20,7 @@ describe('NATS transport', () => {
app.connectMicroservice({
transport: Transport.NATS,
options: {
url: 'nats://0.0.0.0:4222',
url: 'nats://localhost:4222',
},
});
await app.startAllMicroservicesAsync();

View File

@@ -19,9 +19,6 @@ describe('REDIS transport', () => {
app.connectMicroservice({
transport: Transport.REDIS,
options: {
url: 'redis://0.0.0.0:6379',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -20,7 +20,7 @@ describe('RabbitMQ transport', () => {
app.connectMicroservice({
transport: Transport.RMQ,
options: {
urls: [`amqp://0.0.0.0:5672`],
urls: [`amqp://localhost:5672`],
queue: 'test',
queueOptions: { durable: false },
socketOptions: { noDelay: true },

View File

@@ -20,9 +20,6 @@ describe('RPC transport', () => {
app.connectMicroservice({
transport: Transport.TCP,
options: {
host: '0.0.0.0',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/microservices": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.0.tgz",
"integrity": "sha512-OPUFsHNds0UGYWCLxH5SCZHfOvUh4m3pTVV8pdZKNqYPiyzwRku2lQZSTQCtnQmj4YMt4vL2WO6sfRqESkQkFw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,9 +38,9 @@
}
},
"@nestjs/platform-express": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.6.0.tgz",
"integrity": "sha512-lr+S77CX1cJr1f0dtWS/iuJzaSnVcq7O+iLAdV34XzK1qEx+nozfzFL/VgtatgnB7/A+G/SEwrGEvMWtcfL//A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.5.3.tgz",
"integrity": "sha512-c5n4XUbDDmF6MfBGYWM1jtsIDpVsOfOQtf3S0w3IeJNqm7dnmVAvO2Jk+RsYpt50tN4NAXntM3YTuTDqMb9uiA==",
"requires": {
"body-parser": "1.19.0",
"cors": "2.8.5",
@@ -49,17 +49,17 @@
}
},
"@nestjs/testing": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.0.tgz",
"integrity": "sha512-Ulb+DbtRxh0Unl4egEJDMako/125MWNKyxQuQei5AJmF5rdVLZuy5KpoH/ymDHTx8s6YDGOin1dXQVZgbCFR/A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.0.tgz",
"integrity": "sha512-T+ARP0HZIQHadiyXMWe5ccoRbdNCAD20yM1ckVog9jaJmcD2XVQEqfgvUa8P1FO+LIK5pjNnSo1Ov3mXsK6EdA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"requires": {
"iterare": "1.2.0"
}
@@ -324,9 +324,9 @@
}
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"content-disposition": {
"version": "0.5.3",
@@ -1117,9 +1117,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"type-is": {
"version": "1.6.18",
@@ -1171,9 +1171,9 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,12 +7,12 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/microservices": "6.6.0",
"@nestjs/platform-express": "6.6.0",
"@nestjs/testing": "6.6.0",
"@nestjs/websockets": "6.6.0",
"@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",
"amqp-connection-manager": "3.0.0",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",

View File

@@ -25,26 +25,26 @@
}
},
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/mongoose": {
@@ -72,9 +72,9 @@
}
},
"@types/mongodb": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.1.tgz",
"integrity": "sha512-Va7o1fN3zeabmIJSQ6yuAWkqPvrT38HSTIi4YbVOb2UL7FJ4diXrWt+OUuuEFWAVPtF9VZV5h+7LDYdzgXWgQA==",
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.0.tgz",
"integrity": "sha512-YMrve0uBOqFDEiezQk3AfWV73g871/rQTAEb8Y2CSlbySnV/2OyerI1DAOUUJQaIqGEWWaYF6GMPO6wTErLUuw==",
"dev": true,
"requires": {
"@types/bson": "*",
@@ -82,9 +82,9 @@
}
},
"@types/mongoose": {
"version": "5.5.15",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.15.tgz",
"integrity": "sha512-LgUHpGl6mmcyzjZR/afUZ7mDPjDd38mA0HCf8vL11otVKiNGyu7ug8z3ePx2QAqcPrxbtfaJVgirdBeNXYG54Q==",
"version": "5.5.13",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.13.tgz",
"integrity": "sha512-k7Kxk5gugsZhkl7euWH1p6lmIdh9W8AsQgX0cO7kaihBie/P3ywU8LFMqo9ey6frdHBlGVaNICTeFZ/pZ6s5Lg==",
"dev": true,
"requires": {
"@types/mongodb": "*",
@@ -229,9 +229,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"d": {
"version": "1.0.1",
@@ -415,9 +415,9 @@
}
},
"kareem": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz",
"integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw=="
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz",
"integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg=="
},
"lodash": {
"version": "4.17.15",
@@ -504,13 +504,13 @@
}
},
"mongoose": {
"version": "5.6.11",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.11.tgz",
"integrity": "sha512-+Mxfmu2Jcspmdqk1111BLUj5mzSLHWKVovImkjzO9GMymTwkHshsuSFmUN7ou4dWy2WR8DPSJcwU52HhnnNk8Q==",
"version": "5.6.10",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.10.tgz",
"integrity": "sha512-lxWvF4Vl2118K2nZTj+QAEEmNBCbmUAcmF/roe8d+68Np4RXKEQvmpqm1c3aIlE9AVMp//eKB8IfXr38ZHe0Zw==",
"requires": {
"async": "2.6.2",
"bson": "~1.1.1",
"kareem": "2.3.1",
"kareem": "2.3.0",
"mongodb": "3.2.7",
"mongodb-core": "3.2.7",
"mongoose-legacy-pluralize": "1.0.2",
@@ -766,9 +766,9 @@
}
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -776,9 +776,9 @@
"integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g=="
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"wrappy": {
"version": "1.0.2",

View File

@@ -9,16 +9,16 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/mongoose": "6.1.2",
"mongoose": "5.6.11",
"mongoose": "5.6.10",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"typescript": "3.5.3"
},
"devDependencies": {
"@types/mongoose": "5.5.15",
"@types/mongoose": "5.5.13",
"@types/node": "7.10.7",
"ts-node": "8.3.0",
"tslint": "5.19.0"

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/microservices": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.0.tgz",
"integrity": "sha512-OPUFsHNds0UGYWCLxH5SCZHfOvUh4m3pTVV8pdZKNqYPiyzwRku2lQZSTQCtnQmj4YMt4vL2WO6sfRqESkQkFw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.0.tgz",
"integrity": "sha512-Ulb+DbtRxh0Unl4egEJDMako/125MWNKyxQuQei5AJmF5rdVLZuy5KpoH/ymDHTx8s6YDGOin1dXQVZgbCFR/A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.0.tgz",
"integrity": "sha512-T+ARP0HZIQHadiyXMWe5ccoRbdNCAD20yM1ckVog9jaJmcD2XVQEqfgvUa8P1FO+LIK5pjNnSo1Ov3mXsK6EdA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"requires": {
"iterare": "1.2.0"
}
@@ -227,9 +227,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"cookiejar": {
"version": "2.1.2",
@@ -837,9 +837,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -860,9 +860,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/microservices": "6.6.0",
"@nestjs/testing": "6.6.0",
"@nestjs/websockets": "6.6.0",
"@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",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"fastify": "2.7.1",

View File

@@ -47,40 +47,26 @@
}
},
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/graphql": {
@@ -196,9 +182,9 @@
}
},
"@types/body-parser": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz",
"integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
@@ -224,9 +210,9 @@
}
},
"@types/cors": {
"version": "2.8.6",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.6.tgz",
"integrity": "sha512-invOmosX0DqbpA+cE2yoHGUlF/blyf7nB0OGYBBiH27crcVm5NmFaZkLP4Ta1hGaesckCi5lVLlydNJCxkTOSg==",
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-GmK8AKu8i+s+EChK/uZ5IbrXPcPaQKWaNSGevDT/7o3gFObwSUQwqb1jMqxuo+YPvj0ckGzINI+EO7EHcmJjKg==",
"requires": {
"@types/express": "*"
}
@@ -237,9 +223,9 @@
"integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA=="
},
"@types/express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.1.tgz",
"integrity": "sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w==",
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.0.tgz",
"integrity": "sha512-CjaMu57cjgjuZbh9DpkloeGxV45CnMGlVd+XpG7Gm9QgVrd7KFq+X4HY0vM+2v0bczS48Wg7bvnMY5TN+Xmcfw==",
"requires": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "*",
@@ -247,22 +233,14 @@
}
},
"@types/express-serve-static-core": {
"version": "4.16.9",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz",
"integrity": "sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ==",
"version": "4.16.7",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.7.tgz",
"integrity": "sha512-847KvL8Q1y3TtFLRTXcVakErLJQgdpFSaq+k043xefz9raEf0C7HalpSY7OW5PyjCnY8P7bPW5t/Co9qqp+USg==",
"requires": {
"@types/node": "*",
"@types/range-parser": "*"
}
},
"@types/fs-capacitor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz",
"integrity": "sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ==",
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
@@ -279,30 +257,19 @@
"integrity": "sha512-okXbUmdZFMO3AYBEJCcpJFPFDkKmIiZZBqWD5TmPtAv+GHfjD2qLZEI0PvZ8IWMU4ozoK2HV2lDxWjw4LbVlnw=="
},
"@types/graphql-upload": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.2.tgz",
"integrity": "sha512-7pfyXHmfa2W/hrM2Q++V7U7zdgSQj8i+wuuTV9FxOI0puKYcBB1GU2DMa/WPbnDPec/1CGWMIPVmhpzZ1ItVlA==",
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.0.tgz",
"integrity": "sha512-xeDYfZb0SeRpCRuivN9TXLEVsbG0F4inFtx03yadZeaTXr1kC224/ZvlV6NKqQ//HNvUxneYcEoUB5ugJc8dnA==",
"requires": {
"@types/express": "*",
"@types/fs-capacitor": "*",
"@types/koa": "*",
"graphql": "14.5.0"
},
"dependencies": {
"graphql": {
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
}
"@types/graphql": "*",
"@types/koa": "*"
}
},
"@types/http-assert": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz",
"integrity": "sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ=="
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.0.tgz",
"integrity": "sha512-8CBLG8RmxSvoY07FE6M/QpvJ7J5KzeKqF8eWN7Dq6Ks+lBTQae8Roc2G81lUu2Kw5Ju1gymOuvgyUsussbjAaA=="
},
"@types/keygrip": {
"version": "1.0.1",
@@ -361,9 +328,9 @@
"integrity": "sha512-ffCdcrEE5h8DqVxinQjo+2d1q+FV5z7iNtPofw3JsrltSoSVlOGaW0rY8XxtO9XukdTn8TaCGWmk2VFGhI70mg=="
},
"@types/serve-static": {
"version": "1.13.3",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz",
"integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==",
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==",
"requires": {
"@types/express-serve-static-core": "*",
"@types/mime": "*"
@@ -375,10 +342,11 @@
"integrity": "sha512-k/ju1RsdP5ACFUWebqsyEy0avP5uNJCs2p3pmTHzOZdd4gMSAJTq7iUEHFY3tt3emBrPTm6oGvfZ4SzcqOgLPQ=="
},
"@types/ws": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.3.tgz",
"integrity": "sha512-yBTM0P05Tx9iXGq00BbJPo37ox68R5vaGTXivs6RGh/BQ6QP5zqZDGWdAO6JbRE/iR1l80xeGAwCQS2nMV9S/w==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.1.tgz",
"integrity": "sha512-EzH8k1gyZ4xih/MaZTXwT2xOkPiIMSrhQ9b8wrlX88L0T02eYsddatQlwVFlEPyEqV0ChpdpNnE51QPH6NVT4Q==",
"requires": {
"@types/events": "*",
"@types/node": "*"
}
},
@@ -455,18 +423,6 @@
"apollo-server-types": "0.2.1",
"async-retry": "^1.2.1",
"graphql-extensions": "0.9.1"
},
"dependencies": {
"graphql-extensions": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
"apollo-server-types": "0.2.1"
}
}
}
},
"apollo-engine-reporting-protobuf": {
@@ -516,9 +472,9 @@
}
},
"apollo-server-core": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.9.0.tgz",
"integrity": "sha512-IvKIgqOqEEB8nszlpHWzlhAu4376So2PgNhFP6UrlfNTllt/WDti5YMOHnVimPWIDHmLPKFan0+wfzpsoRCRdg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.8.1.tgz",
"integrity": "sha512-BpvhKdycTI1v5n8biJ5c/DVF7MCbTL3JtB9llHGkqYgHaTH1gXguh2qD8Vcki+rpUNO5P1lcj5V6oVXoSUFXlA==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"@apollographql/graphql-playground-html": "1.6.24",
@@ -534,7 +490,7 @@
"apollo-server-types": "0.2.1",
"apollo-tracing": "0.8.1",
"fast-json-stable-stringify": "^2.0.0",
"graphql-extensions": "0.10.0",
"graphql-extensions": "0.9.1",
"graphql-tag": "^2.9.2",
"graphql-tools": "^4.0.0",
"graphql-upload": "^8.0.2",
@@ -568,23 +524,22 @@
"integrity": "sha512-errZvnh0vUQChecT7M4A/h94dnBSRL213dNxpM5ueMypaLYgnp4hiCTWIEaooo9E4yMGd1qA6WaNbLDG2+bjcg=="
},
"apollo-server-express": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.9.0.tgz",
"integrity": "sha512-+057V6Ui1BX69jUlV6YDQ7Xw9CCBfowN/GauvyF09KnsjYUJ+cB1xf4mkj/HAjaz4ReXQaALJNr2qPYPXS4R6w==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.8.1.tgz",
"integrity": "sha512-XoWqSuNQkL8ivBq5LXJW6wV0/Ef+m8w4fAK/7PBspLHVfDAbHRyRr6zraotim2Kl7NOnzcqHtb6sB9yozjL0hA==",
"requires": {
"@apollographql/graphql-playground-html": "1.6.24",
"@types/accepts": "^1.3.5",
"@types/body-parser": "1.17.1",
"@types/body-parser": "1.17.0",
"@types/cors": "^2.8.4",
"@types/express": "4.17.1",
"@types/express": "4.17.0",
"accepts": "^1.3.5",
"apollo-server-core": "2.9.0",
"apollo-server-core": "2.8.1",
"apollo-server-types": "0.2.1",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"graphql-subscriptions": "^1.0.0",
"graphql-tools": "^4.0.0",
"parseurl": "^1.3.2",
"subscriptions-transport-ws": "^0.9.16",
"type-is": "^1.6.16"
}
@@ -888,9 +843,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"content-type": {
"version": "1.0.4",
@@ -898,9 +853,9 @@
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"core-js": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz",
"integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw=="
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.1.4.tgz",
"integrity": "sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ=="
},
"cors": {
"version": "2.8.5",
@@ -1213,17 +1168,17 @@
"integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg=="
},
"graphql": {
"version": "14.5.3",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.3.tgz",
"integrity": "sha512-W8A8nt9BsMg0ZK2qA3DJIVU6muWhxZRYLTmc+5XGwzWzVdUdPVlAAg5hTBjiTISEnzsKL/onasu6vl3kgGTbYg==",
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
},
"graphql-extensions": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.10.0.tgz",
"integrity": "sha512-qz9Ev0NgsRxdTYqYSCpYwBWS9r1imm+vCBt3PmHzqZlE7SEpUPGddn9oKcLRB/P8uXT6dsr60hDmDHukIxiVOw==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
@@ -1693,11 +1648,6 @@
"resolved": "https://registry.npmjs.org/optional/-/optional-0.1.4.tgz",
"integrity": "sha512-gtvrrCfkE08wKcgXaVwQVgwEQ8vel2dc5DDBn9RLQZ3YtmtkBss6A2HY6BnJH4N/4Ku97Ri/SF8sNWE2225WJw=="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -1740,9 +1690,9 @@
},
"dependencies": {
"@types/node": {
"version": "10.14.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.16.tgz",
"integrity": "sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA=="
"version": "10.14.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.13.tgz",
"integrity": "sha512-yN/FNNW1UYsRR1wwAoyOwqvDuLDtVXnaJTZ898XIw/Q5cCaeVAlVwvsmXLX5PuiScBYwZsZU4JYSHB3TvfdwvQ=="
}
}
},
@@ -2017,9 +1967,9 @@
}
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"type-graphql": {
"version": "0.17.5",

View File

@@ -9,13 +9,13 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/graphql": "6.4.2",
"apollo-server-express": "2.9.0",
"apollo-server-express": "2.8.1",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"graphql": "14.5.3",
"graphql": "14.5.0",
"graphql-tools": "4.0.5",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",

View File

@@ -25,40 +25,26 @@
}
},
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.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=="
}
"uuid": "3.3.2"
}
},
"@nestjs/typeorm": {
@@ -270,9 +256,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"core-util-is": {
"version": "1.0.2",
@@ -1071,9 +1057,9 @@
}
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typeorm": {
"version": "0.2.18",

View File

@@ -9,8 +9,8 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/typeorm": "6.1.3",
"mysql": "2.17.1",
"reflect-metadata": "0.1.13",

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.0.tgz",
"integrity": "sha512-QkhvoZr8Qr+NBuOF/N5LRmyOL/PG9uV5NcQJRKKWA218W0c1x0/B66LqY4W128YYG963JWpojewowoWYHo4mCw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.3"
"uuid": "3.3.2"
}
},
"@nestjs/core": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.0.tgz",
"integrity": "sha512-LSTrXjM6pV8OX0GXGhKdE9rR3GhAwjEskaaQwoR24ica80sAdKZ81IV5nAU70lxBWYQwL5OkjdbxXtujRmTM6g==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"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.3"
"uuid": "3.3.2"
}
},
"@nestjs/microservices": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.0.tgz",
"integrity": "sha512-OPUFsHNds0UGYWCLxH5SCZHfOvUh4m3pTVV8pdZKNqYPiyzwRku2lQZSTQCtnQmj4YMt4vL2WO6sfRqESkQkFw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.0.tgz",
"integrity": "sha512-Ulb+DbtRxh0Unl4egEJDMako/125MWNKyxQuQei5AJmF5rdVLZuy5KpoH/ymDHTx8s6YDGOin1dXQVZgbCFR/A==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.0.tgz",
"integrity": "sha512-T+ARP0HZIQHadiyXMWe5ccoRbdNCAD20yM1ckVog9jaJmcD2XVQEqfgvUa8P1FO+LIK5pjNnSo1Ov3mXsK6EdA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"requires": {
"iterare": "1.2.0"
}
@@ -181,9 +181,9 @@
"dev": true
},
"consola": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
},
"cookiejar": {
"version": "2.1.2",
@@ -593,9 +593,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
},
"typescript": {
"version": "3.5.3",
@@ -609,9 +609,9 @@
"dev": true
},
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.6.0",
"@nestjs/core": "6.6.0",
"@nestjs/microservices": "6.6.0",
"@nestjs/testing": "6.6.0",
"@nestjs/websockets": "6.6.0",
"@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",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "6.6.2"
"version": "6.5.3"
}

198
package-lock.json generated
View File

@@ -460,9 +460,9 @@
"dev": true
},
"@types/body-parser": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz",
"integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==",
"requires": {
"@types/connect": "*",
"@types/node": "*"
@@ -558,14 +558,6 @@
"fastify-cors": "*"
}
},
"@types/fs-capacitor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/fs-capacitor/-/fs-capacitor-2.0.0.tgz",
"integrity": "sha512-FKVPOCFbhCvZxpVAMhdBdTfVfXUpsh15wFHgqOKxh9N9vzWZVuWCSijZ5T4U34XYNnuj2oduh6xcs1i+LPI+BQ==",
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
@@ -586,25 +578,19 @@
"@types/node": "*"
}
},
"@types/graphql": {
"version": "14.2.3",
"resolved": "https://registry.npmjs.org/@types/graphql/-/graphql-14.2.3.tgz",
"integrity": "sha512-UoCovaxbJIxagCvVfalfK7YaNhmxj3BQFRQ2RHQKLiu+9wNXhJnlbspsLHt/YQM99IaLUUFJNzCwzc6W0ypMeQ=="
},
"@types/graphql-upload": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.2.tgz",
"integrity": "sha512-7pfyXHmfa2W/hrM2Q++V7U7zdgSQj8i+wuuTV9FxOI0puKYcBB1GU2DMa/WPbnDPec/1CGWMIPVmhpzZ1ItVlA==",
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@types/graphql-upload/-/graphql-upload-8.0.0.tgz",
"integrity": "sha512-xeDYfZb0SeRpCRuivN9TXLEVsbG0F4inFtx03yadZeaTXr1kC224/ZvlV6NKqQ//HNvUxneYcEoUB5ugJc8dnA==",
"requires": {
"@types/express": "*",
"@types/fs-capacitor": "*",
"@types/koa": "*",
"graphql": "14.5.0"
},
"dependencies": {
"graphql": {
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
}
"@types/graphql": "*",
"@types/koa": "*"
}
},
"@types/gulp": {
@@ -619,9 +605,9 @@
}
},
"@types/http-assert": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz",
"integrity": "sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ=="
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.0.tgz",
"integrity": "sha512-8CBLG8RmxSvoY07FE6M/QpvJ7J5KzeKqF8eWN7Dq6Ks+lBTQae8Roc2G81lUu2Kw5Ju1gymOuvgyUsussbjAaA=="
},
"@types/kafka-node": {
"version": "2.0.8",
@@ -1039,18 +1025,6 @@
"apollo-server-types": "0.2.1",
"async-retry": "^1.2.1",
"graphql-extensions": "0.9.1"
},
"dependencies": {
"graphql-extensions": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
"apollo-server-types": "0.2.1"
}
}
}
},
"apollo-engine-reporting-protobuf": {
@@ -1100,9 +1074,9 @@
}
},
"apollo-server-core": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.9.0.tgz",
"integrity": "sha512-IvKIgqOqEEB8nszlpHWzlhAu4376So2PgNhFP6UrlfNTllt/WDti5YMOHnVimPWIDHmLPKFan0+wfzpsoRCRdg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.8.1.tgz",
"integrity": "sha512-BpvhKdycTI1v5n8biJ5c/DVF7MCbTL3JtB9llHGkqYgHaTH1gXguh2qD8Vcki+rpUNO5P1lcj5V6oVXoSUFXlA==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"@apollographql/graphql-playground-html": "1.6.24",
@@ -1118,7 +1092,7 @@
"apollo-server-types": "0.2.1",
"apollo-tracing": "0.8.1",
"fast-json-stable-stringify": "^2.0.0",
"graphql-extensions": "0.10.0",
"graphql-extensions": "0.9.1",
"graphql-tag": "^2.9.2",
"graphql-tools": "^4.0.0",
"graphql-upload": "^8.0.2",
@@ -1142,23 +1116,21 @@
"integrity": "sha512-errZvnh0vUQChecT7M4A/h94dnBSRL213dNxpM5ueMypaLYgnp4hiCTWIEaooo9E4yMGd1qA6WaNbLDG2+bjcg=="
},
"apollo-server-express": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.9.0.tgz",
"integrity": "sha512-+057V6Ui1BX69jUlV6YDQ7Xw9CCBfowN/GauvyF09KnsjYUJ+cB1xf4mkj/HAjaz4ReXQaALJNr2qPYPXS4R6w==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.8.1.tgz",
"integrity": "sha512-XoWqSuNQkL8ivBq5LXJW6wV0/Ef+m8w4fAK/7PBspLHVfDAbHRyRr6zraotim2Kl7NOnzcqHtb6sB9yozjL0hA==",
"requires": {
"@apollographql/graphql-playground-html": "1.6.24",
"@types/accepts": "^1.3.5",
"@types/body-parser": "1.17.1",
"@types/body-parser": "1.17.0",
"@types/cors": "^2.8.4",
"@types/express": "4.17.1",
"accepts": "^1.3.5",
"apollo-server-core": "2.9.0",
"apollo-server-core": "2.8.1",
"apollo-server-types": "0.2.1",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"graphql-subscriptions": "^1.0.0",
"graphql-tools": "^4.0.0",
"parseurl": "^1.3.2",
"subscriptions-transport-ws": "^0.9.16",
"type-is": "^1.6.16"
}
@@ -3026,9 +2998,9 @@
}
},
"p-limit": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
"integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz",
"integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
@@ -4608,57 +4580,16 @@
}
},
"del": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/del/-/del-5.1.0.tgz",
"integrity": "sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/del/-/del-5.0.0.tgz",
"integrity": "sha512-TfU3nUY0WDIhN18eq+pgpbLY9AfL5RfiE9czKaTSolc6aK7qASXfDErvYgjV1UqCR4sNXDoxO0/idPmhDUt2Sg==",
"dev": true,
"requires": {
"globby": "^10.0.1",
"graceful-fs": "^4.2.2",
"is-glob": "^4.0.1",
"is-path-cwd": "^2.2.0",
"is-path-inside": "^3.0.1",
"p-map": "^3.0.0",
"rimraf": "^3.0.0",
"slash": "^3.0.0"
},
"dependencies": {
"graceful-fs": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz",
"integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==",
"dev": true
},
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
}
},
"is-path-inside": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.1.tgz",
"integrity": "sha512-CKstxrctq1kUesU6WhtZDbYKzzYBuRH0UYInAVrkc/EYdB9ltbfE0gOoayG9nhohG6447sOOVGhHqsdmBvkbNg==",
"dev": true
},
"rimraf": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.0.tgz",
"integrity": "sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true
}
"globby": "^10.0.0",
"is-path-cwd": "^2.0.0",
"is-path-in-cwd": "^2.0.0",
"p-map": "^2.0.0",
"rimraf": "^2.6.3"
}
},
"delayed-stream": {
@@ -7384,17 +7315,17 @@
"dev": true
},
"graphql": {
"version": "14.5.3",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.3.tgz",
"integrity": "sha512-W8A8nt9BsMg0ZK2qA3DJIVU6muWhxZRYLTmc+5XGwzWzVdUdPVlAAg5hTBjiTISEnzsKL/onasu6vl3kgGTbYg==",
"version": "14.5.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.5.0.tgz",
"integrity": "sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==",
"requires": {
"iterall": "^1.2.2"
}
},
"graphql-extensions": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.10.0.tgz",
"integrity": "sha512-qz9Ev0NgsRxdTYqYSCpYwBWS9r1imm+vCBt3PmHzqZlE7SEpUPGddn9oKcLRB/P8uXT6dsr60hDmDHukIxiVOw==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.9.1.tgz",
"integrity": "sha512-JR/KStdwALd48B/xSG/Mi85zamuJd8THvVlzGM5juznPDN0wTYG5SARGzzvoqHxgxuUHYdzpvESwMAisORJdCQ==",
"requires": {
"@apollographql/apollo-tools": "^0.4.0",
"apollo-server-env": "2.4.1",
@@ -9300,6 +9231,26 @@
"integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
"dev": true
},
"is-path-in-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz",
"integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==",
"dev": true,
"requires": {
"is-path-inside": "^2.1.0"
},
"dependencies": {
"is-path-inside": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz",
"integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==",
"dev": true,
"requires": {
"path-is-inside": "^1.0.2"
}
}
}
},
"is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
@@ -10257,9 +10208,9 @@
}
},
"lint-staged": {
"version": "9.2.5",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-9.2.5.tgz",
"integrity": "sha512-d99gTBFMJ29159+9iRvaMEQstmNcPAbQbhHSYw6D/1FncvFdIj8lWHztaq3Uq+tbZPABHXQ/fyN7Rp1QwF8HIw==",
"version": "9.2.3",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-9.2.3.tgz",
"integrity": "sha512-ovDmF0c0VJDTP0VmwLetJQ+lVGyNqOkTniwO9S0MOJxGxIExpSRTL56/ZmvXZ1tHNA53GBbXQbfS8RnNGRXFjg==",
"dev": true,
"requires": {
"chalk": "^2.4.2",
@@ -10473,14 +10424,6 @@
"listr-verbose-renderer": "^0.5.0",
"p-map": "^2.0.0",
"rxjs": "^6.3.3"
},
"dependencies": {
"p-map": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz",
"integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
"dev": true
}
}
},
"listr-silent-renderer": {
@@ -12456,13 +12399,10 @@
}
},
"p-map": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
"integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
"dev": true,
"requires": {
"aggregate-error": "^3.0.0"
}
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz",
"integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
"dev": true
},
"p-try": {
"version": "1.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "6.6.1",
"version": "6.5.3",
"description": "Modern, fast, powerful node.js web framework",
"scripts": {
"coverage": "nyc report --reporter=text-lcov | coveralls",
@@ -9,19 +9,17 @@
"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",
"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",
"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",
"postinstall": "opencollective",
"prerelease": "gulp copy-misc && gulp build --dist node_modules/@nestjs",
"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\""
"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\""
},
"engines": {
"node": ">= 8.9.0"
@@ -42,7 +40,7 @@
"@nuxtjs/opencollective": "0.2.2",
"amqp-connection-manager": "3.0.0",
"amqplib": "0.5.5",
"apollo-server-express": "2.9.0",
"apollo-server-express": "2.8.1",
"axios": "0.19.0",
"cache-manager": "2.10.0",
"class-transformer": "0.2.3",
@@ -58,7 +56,7 @@
"fastify-cors": "2.1.3",
"fastify-formbody": "3.1.0",
"fastify-multipart": "1.0.2",
"graphql": "14.5.3",
"graphql": "14.5.0",
"grpc": "1.23.3",
"http2": "3.3.7",
"iterare": "1.2.0",
@@ -119,7 +117,7 @@
"imports-loader": "0.8.0",
"json-loader": "0.5.7",
"lerna": "2.11.0",
"lint-staged": "9.2.5",
"lint-staged": "9.2.3",
"mocha": "3.5.3",
"nodemon": "1.19.1",
"nyc": "14.1.1",

View File

@@ -2,15 +2,18 @@
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" 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://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://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://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>
@@ -57,23 +60,25 @@ 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="110" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> &nbsp;
<a href="https://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="80" valign="middle" /></a> &nbsp; <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="22" valign="middle" /></a> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <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> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> &nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="24" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> &nbsp; &nbsp; <a href="https://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="70" valign="middle" /></a> &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a> &nbsp;
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a>
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="125" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="180" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="130" valign="middle" /></a> &nbsp;
<a href="https://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="100" valign="middle" /></a> &nbsp; <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="26" valign="middle" /></a> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="30" valign="middle" /></a>
&nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="36" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="24" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="28" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="20" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="30" valign="middle" /></a> &nbsp;
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="35" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="31" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="28" valign="middle" /></a> &nbsp; &nbsp; <a href="https://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="80" valign="middle" /></a> &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="90" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="145" valign="middle" /></a> &nbsp;
<a href="http://xtremis.com/" target="_blank"><img src="https://nestjs.com/img/logo-xtremis.svg" width="145" valign="middle" /></a>
## Backers
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1000"></a>
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1600"></a>
## Stay in touch

View File

@@ -8,25 +8,11 @@ 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,
@@ -34,14 +20,6 @@ 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,

View File

@@ -4,11 +4,6 @@ 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,

View File

@@ -1,17 +1,4 @@
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);

View File

@@ -2,70 +2,19 @@ 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;
}

View File

@@ -5,47 +5,17 @@ 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[];
}

View File

@@ -1,12 +1,7 @@
/**
* 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
* Binds parameter decorators to the method
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
* @param ...decorators
*/
export function Bind(...decorators: any[]): MethodDecorator {
return <T>(

View File

@@ -2,21 +2,8 @@ import { FILTER_CATCH_EXCEPTIONS } from '../../constants';
import { Type } from '../../interfaces';
/**
* 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
* 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.
*/
export function Catch(...exceptions: Type<any>[]): ClassDecorator {
return (target: object) => {

View File

@@ -3,123 +3,79 @@ import { isString, isUndefined } from '../../utils/shared.utils';
import { ScopeOptions } from './../../interfaces/scope-options.interface';
/**
* Interface defining options that can be passed to `@Controller()` decorator
*
* 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.
* Specifies an optional route path prefix. When specified, the route path
* for a handler is determined by concatenating the prefix with any path
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
path?: 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.
*
* @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.
*
* HTTP Controllers optionally accept configuration
* metadata that determines route paths that route handlers in the class
* respond to, and lifetime [scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage).
*
* 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`
* (e.g., `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.
* A Microservice Controller responds to Requests and Responses, 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)
*
* @usageNotes
*
* ### Setting controller options
* The controller decorator takes an optional options object in plain JSON format.
* This object can take properties `path` and `scope`.
*
* ### Setting the default route path prefix
* The following example sets `cats` as the default route path prefix for all route
* handlers in this controller. When simply passing a route prefix, you can pass
* it as a string as shown in the example below.
*
* ```typescript
* @Controller('cats')
* export class CatsController {
* @Get()
* findall(): string {
* return 'This action returns all cats';
* }
* }
* ```
* This route handler will respond to the request
* `GET /cats`
*
* ### Setting the injection scope
* The following example sets the scope for all requests in the controller
* to request-scoped. Each request will cause Nest to create a new instance of
* the controller.
* ```typescript
* @Controller({
* path: 'cats',
* scope: Scope.REQUEST,
* })
* export class CatsController { ... }
* ```
*
* [Read more about scopes here.](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/

View File

@@ -34,26 +34,14 @@ const defineFiltersMetadata = (...filters: (Function | ExceptionFilter)[]) => {
};
/**
* Decorator that binds exception filters to the scope of the controller or
* method, depending on its context.
* 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)
*
* When `@UseFilters` is used at the controller level, the filter will be
* applied to every handler (method) in the controller.
* 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 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
* @param {ExceptionFilter[]} ...filters
*/
export const UseFilters = (...filters: (ExceptionFilter | Function)[]) =>
defineFiltersMetadata(...filters);

View File

@@ -6,7 +6,16 @@ import { isFunction, isUndefined } from '../../utils/shared.utils';
/**
* Decorator that marks a constructor parameter as a target for
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection). Takes a single
* required parameter which is the
* [injection token](https://docs.nestjs.com/fundamentals/custom-providers). The injection token serves
* as the lookup key for the [provider](https://docs.nestjs.com/providers) that will be injected
* (assigned to the constructor parameter).
*
* 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.
*
* Any injected provider must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
@@ -18,21 +27,59 @@ import { isFunction, isUndefined } from '../../utils/shared.utils';
* - 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)
*
* @usageNotes
*
* #### Injecting with a type (class name)
*
* ```typescript
* import { Inject } from '@nestjs/common';
* import { ConfigService } from './config.service';
*
* export class CatsService {
* constructor(@Inject(ConfigService) private readonly configService) {}
* }
* ```
*
* The above is equivalent to the conventional constructor injection syntax:
* ```typescript
* import { ConfigService } from './config.service';
*
* export class CatsService {
* constructor(private readonly configService: ConfigService) {}
* }
* ```
* #### Injecting with a string
*
* Assume we've registered a provider with the string `'CONNECTION'` as follows:
*
* ```typescript
* import { connection } from './connection';
* const connectionProvider = {
* provide: 'CONNECTION',
* useValue: connection,
* };
*
* @Module({
* providers: [connectionProvider],
* })
* export class ApplicationModule {}
* ```
* As a result, we now have a provider bound to the DI container using the
* injection token `'CONNECTION'`. This provider can be injected as follows:
*
* ```typescript
* @Injectable()
* export class CatsRepository {
* constructor(@Inject('CONNECTION') connection: Connection) {}
* }
* ```
* @publicApi
*/
export function Inject<T = any>(token?: T) {
return (target: Object, key: string | symbol, index?: number) => {
token = token || Reflect.getMetadata('design:type', target, key);

View File

@@ -13,10 +13,9 @@ import { Type } from './../../interfaces/type.interface';
export interface InjectableOptions extends ScopeOptions {}
/**
* 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.
* 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
@@ -32,12 +31,81 @@ export interface InjectableOptions extends ScopeOptions {}
* 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)
*
* @usageNotes
*
* #### Setting provider scope
*
* The `@Injector()` decorator takes an optional options object in plain JSON format.
* This object has one property: `scope`.
*
* Following is an example of setting a provider's scope to per-request. See more
* about [injection scopes here](https://docs.nestjs.com/fundamentals/injection-scopes).
*
* ```typescript
* import { Injectable, Scope } from '@nestjs/common';
*
* @Injectable({ scope: Scope.REQUEST })
* export class CatsService {}
* ```
*
* #### Declaring providers
*
* Providers are declared using the `@Injectable()` decorator and a standard
* JavaScript class.
*
* ```typescript
* import { Injectable } from '@nestjs/common';
* import { Cat } from './interfaces/cat.interface';
*
* @Injectable()
* export class CatsService {
* private readonly cats: Cat[] = [];
*
* create(cat: Cat) {
* this.cats.push(cat);
* }
*
* findAll(): Cat[] {
* return this.cats;
* }
* }
* ```
*
* #### Using providers
*
* Providers created using the `@Injectable()` decorator use an
* [injection token](https://docs.nestjs.com/fundamentals/custom-providers) that is the class type.
*
* For example to inject the provider declared above using constructor injection,
* use the following syntax. In this example, `CatsService` is the name of
* the provider class declared earlier, and is used as the injection token in
* the constructor.
*
* ```typescript
* import { Controller, Get, Post, Body } from '@nestjs/common';
* import { CreateCatDto } from './dto/create-cat.dto';
* import { CatsService } from './cats.service';
* import { Cat } from './interfaces/cat.interface';
*
* @Controller('cats')
* export class CatsController {
* constructor(private readonly catsService: CatsService) {}
*
* @Post()
* async create(@Body() createCatDto: CreateCatDto) {
* this.catsService.create(createCatDto);
* }
*
* @Get()
* async findAll(): Promise<Cat[]> {
* return this.catsService.findAll();
* }
* }
* ```
* @publicApi
*/
export function Injectable(options?: InjectableOptions): ClassDecorator {

View File

@@ -5,17 +5,7 @@ import {
import { isUndefined } from '../../utils/shared.utils';
/**
* 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
* Sets dependency as an optional one.
*/
export function Optional() {
return (target: Object, key: string | symbol, index?: number) => {

View File

@@ -1,20 +1,8 @@
import { Logger } from './../../services/logger.service';
/**
* 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
* Assigns the metadata to the class/function under specified `key`.
* This metadata can be reflected using `Reflector` class.
*/
export const SetMetadata = <K = any, V = any>(
metadataKey: K,

View File

@@ -14,15 +14,28 @@ import { validateEach } from '../../utils/validate-each.util';
* 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)
*
* ### Passing a guard by type
* In this example, we pass a guard type, which will delegate instantiating
* the guard to the Nest framework, and will allow Dependency Injection.
*
* ```typescript
* @Controller('cats')
* @UseGuards(RolesGuard)
* export class CatsController {}
* ```
*
* ### Passing a guard instance
* It's also possible to pass an instance of a guard directly to the decorator.
*
* ```typescript
* @Controller('cats')
* @UseGuards(new RolesGuard())
* export class CatsController {}
* ```
* @publicApi
*/
export function UseGuards(...guards: (CanActivate | Function)[]) {

View File

@@ -5,25 +5,14 @@ import { isFunction } from '../../utils/shared.utils';
import { validateEach } from '../../utils/validate-each.util';
/**
* Decorator that binds interceptors to the scope of the controller or method,
* depending on its context.
* Binds interceptors to the particular context.
* When the `@UseInterceptors()` is used on the controller level:
* - Interceptor will be register to each handler (every method)
*
* When `@UseInterceptors` is used at the controller level, the interceptor will
* be applied to every handler (method) in the controller.
* When the `@UseInterceptors()` is used on the handle level:
* - Interceptor will be registered only to the specified method
*
* 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
* @param ...interceptors
*/
export function UseInterceptors(
...interceptors: (NestInterceptor | Function)[]

View File

@@ -5,27 +5,15 @@ import { isFunction } from '../../utils/shared.utils';
import { validateEach } from '../../utils/validate-each.util';
/**
* Decorator that binds pipes to the scope of the controller or method,
* depending on its context.
* Binds pipes to the particular context.
* When the `@UsePipes()` is used on the controller level:
* - Pipe will be register to each handler (every method)
*
* When `@UsePipes` is used at the controller level, the pipe will be
* applied to every handler (method) in the controller.
* When the `@UsePipes()` is used on the handle level:
* - Pipe will be registered only to the specified method
*
* 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
* @param {PipeTransform[]} ...pipes
*/
export function UsePipes(...pipes: (PipeTransform | Function)[]) {
return (target: any, key?: string, descriptor?: any) => {
const isPipeValid = <T extends Function | Record<string, any>>(pipe: T) =>

View File

@@ -30,7 +30,6 @@ export type ParamDecoratorEnhancer = ParameterDecorator;
/**
* Defines HTTP route param decorator
*
* @param factory
*/
export function createParamDecorator(
@@ -49,9 +48,7 @@ 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);

View File

@@ -2,13 +2,9 @@ import { HEADERS_METADATA } from '../../constants';
import { extendArrayMetadata } from '../../utils/extend-metadata.util';
/**
* Request method Decorator. Sets a response header.
* 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
* Example: `@Header('Cache-Control', 'none')`
*
* @see [Headers](https://docs.nestjs.com/controllers#headers)
*

View File

@@ -1,14 +1,13 @@
import { HTTP_CODE_METADATA } from '../../constants';
/**
* Request method Decorator. Defines the HTTP response status code. Overrides
* default status code for the decorated request method.
* @publicApi
*
* @param statusCode HTTP response code to be returned by route handler.
* @description
* Defines the HTTP response status code. Overrides default status code for
* the decorated request method.
*
* @see [Http Status Codes](https://docs.nestjs.com/controllers#status-code)
*
* @publicApi
*/
export function HttpCode(statusCode: number): MethodDecorator {
return (target: object, key, descriptor) => {

View File

@@ -3,5 +3,4 @@ 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 './redirect.decorator';
export * from './header.decorator';

View File

@@ -5,13 +5,9 @@ import { REDIRECT_METADATA } from '../../constants';
*
* @publicApi
*/
export function Redirect(url: string, statusCode?: number): MethodDecorator {
export function Redirect(url: string): MethodDecorator {
return (target: object, key, descriptor) => {
Reflect.defineMetadata(
REDIRECT_METADATA,
{ statusCode, url },
descriptor.value,
);
Reflect.defineMetadata(REDIRECT_METADATA, url, descriptor.value);
return descriptor;
};
}

View File

@@ -1,14 +1,11 @@
import { RENDER_METADATA } from '../../constants';
/**
* Route handler method Decorator. Defines a template to be rendered by the controller.
* 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)
* Example: `@Render('index)`
*
* @see [Example](https://github.com/nestjs/nest/blob/master/sample/15-mvc/src/app.controller.ts)
* @publicApi
*/
export function Render(template: string): MethodDecorator {

View File

@@ -31,73 +31,81 @@ const createMappingDecorator = (method: RequestMethod) => (
};
/**
* Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP POST requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Post = createMappingDecorator(RequestMethod.POST);
/**
* Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP GET requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Get = createMappingDecorator(RequestMethod.GET);
/**
* Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP DELETE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Delete = createMappingDecorator(RequestMethod.DELETE);
/**
* Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP PUT requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Put = createMappingDecorator(RequestMethod.PUT);
/**
* Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP PATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Patch = createMappingDecorator(RequestMethod.PATCH);
/**
* Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP OPTIONS requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Options = createMappingDecorator(RequestMethod.OPTIONS);
/**
* Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
* @publicApi
*
* @description
* Routes HTTP HEAD requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Head = createMappingDecorator(RequestMethod.HEAD);
/**
* Route handler (method) Decorator. Routes all HTTP requests to the specified path.
* @publicApi
*
* @description
* Routes all HTTP requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const All = createMappingDecorator(RequestMethod.ALL);

View File

@@ -58,98 +58,21 @@ 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,
);
@@ -158,9 +81,9 @@ export const UploadedFiles: () => ParameterDecorator = createRouteParamDecorator
* property from the `req` object and populates the decorated
* parameter with the value of `headers`.
*
* For example: `async update(@Headers('Cache-Control') cacheControl: string)`
* `property` - optional name of single header property to extract.
*
* @param property name of single header property to extract.
* Example: `async update(@Headers() headers)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
@@ -170,64 +93,10 @@ 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)[]
@@ -235,16 +104,9 @@ export function Query(
/**
* 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.
* parameter with the value of `query`.
*
* 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
* Example: `async find(@Query() query: string)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
@@ -260,87 +122,22 @@ 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.
* Route handler parameter decorator. Extracts the `body`
* property from the `req` object and populates the decorated
* parameter with the value of `body`.
*
* 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.
* Example: `async create(@Body() createCatDto: CreateCatDto)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
@@ -354,110 +151,14 @@ 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)[]

View File

@@ -1,15 +1,38 @@
import { GLOBAL_MODULE_METADATA } from '../../constants';
/**
* Decorator that makes a module global-scoped.
* @publicApi
*
* 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.
* @description
*
* Makes the module global-scoped.
* Once imported into any module, the global-scoped module will be visible
* in all modules.
*
* @see [Global modules](https://docs.nestjs.com/modules#global-modules)
*
* @publicApi
* @usageNotes
*
* `@Global()` makes the `CatsModule` global-scoped. The CatsService provider
* will be ubiquitous, and modules that wish to inject the service will not need to import the CatsModule in their imports array.
*
* Note that the `imports` array is generally the preferred way to make a module's
* API available to consumers.
*
* ```typescript
* import { Module, Global } from '@nestjs/common';
* import { CatsController } from './cats.controller';
* import { CatsService } from './cats.service';
*
* @Global()
* @Module({
* controllers: [CatsController],
* providers: [CatsService],
* exports: [CatsService],
* })
*
* export class CatsModule {}
* ```
*/
export function Global(): ClassDecorator {
return (target: any) => {

View File

@@ -21,17 +21,36 @@ const validateKeys = (keys: string[]) => {
};
/**
* 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
* 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)
*
* @usageNotes
* The following example:
* - declares `CatsController` as a controller to be instantiated when the
* `CatsModule` is bootstrapped
* - declares `CatsService` as a provider that can be injected within the
* module scope of the `CatsModule`
* - exports `CatsService` so that any module that imports `CatsModule`
* may inject `CatsService`
*
* ```typescript
* import { Module } from '@nestjs/common';
* import { CatsController } from './cats.controller';
* import { CatsService } from './cats.service';
*
* @Module({
* controllers: [CatsController],
* providers: [CatsService],
* exports: [CatsService]
* })
* export class CatsModule {}
* ```
*
* @publicApi
*/
export function Module(metadata: ModuleMetadata): ClassDecorator {

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.BAD_GATEWAY),
createHttpExceptionBody(message, error, HttpStatus.BAD_GATEWAY),
HttpStatus.BAD_GATEWAY,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.BAD_REQUEST),
createHttpExceptionBody(message, error, HttpStatus.BAD_REQUEST),
HttpStatus.BAD_REQUEST,
);
}

View File

@@ -1,41 +1,11 @@
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 {
/**
* 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') {
constructor(message?: string | object | any, error = 'Conflict') {
super(
HttpException.createBody(message, error, HttpStatus.CONFLICT),
createHttpExceptionBody(message, error, HttpStatus.CONFLICT),
HttpStatus.CONFLICT,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.FORBIDDEN),
createHttpExceptionBody(message, error, HttpStatus.FORBIDDEN),
HttpStatus.FORBIDDEN,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
createHttpExceptionBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
HttpStatus.GATEWAY_TIMEOUT,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.GONE),
createHttpExceptionBody(message, error, HttpStatus.GONE),
HttpStatus.GONE,
);
}

View File

@@ -1,39 +1,21 @@
import { isString, isObject } from '../utils/shared.utils';
import { isString } 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;
/**
* Instantiate a plain HTTP Exception.
* 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.
*
* @example
* `throw new HttpException()`
* When `response` is an object:
* - object will be stringified and returned to the user as a JSON response,
*
* @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
* When `response` is a string:
* - Nest will create a response with two properties:
* ```
* message: response,
* statusCode: X
* ```
*/
constructor(
private readonly response: string | object,
@@ -59,17 +41,4 @@ 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 };
}
}

View File

@@ -1,45 +1,17 @@
import { HttpStatus } from '../enums/http-status.enum';
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 *ImATeapotException* type errors.
* 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.
*
* 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
* http://save418.com/
*/
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(
HttpException.createBody(message, error, HttpStatus.I_AM_A_TEAPOT),
createHttpExceptionBody(message, error, HttpStatus.I_AM_A_TEAPOT),
HttpStatus.I_AM_A_TEAPOT,
);
}

View File

@@ -1,45 +1,14 @@
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(
HttpException.createBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
createHttpExceptionBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
HttpStatus.INTERNAL_SERVER_ERROR,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
createHttpExceptionBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
HttpStatus.METHOD_NOT_ALLOWED,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.NOT_ACCEPTABLE),
createHttpExceptionBody(message, error, HttpStatus.NOT_ACCEPTABLE),
HttpStatus.NOT_ACCEPTABLE,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.NOT_FOUND),
createHttpExceptionBody(message, error, HttpStatus.NOT_FOUND),
HttpStatus.NOT_FOUND,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.NOT_IMPLEMENTED),
createHttpExceptionBody(message, error, HttpStatus.NOT_IMPLEMENTED),
HttpStatus.NOT_IMPLEMENTED,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
createHttpExceptionBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
HttpStatus.PAYLOAD_TOO_LARGE,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.REQUEST_TIMEOUT),
createHttpExceptionBody(message, error, HttpStatus.REQUEST_TIMEOUT),
HttpStatus.REQUEST_TIMEOUT,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
createHttpExceptionBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
HttpStatus.SERVICE_UNAVAILABLE,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.UNAUTHORIZED),
createHttpExceptionBody(message, error, HttpStatus.UNAUTHORIZED),
HttpStatus.UNAUTHORIZED,
);
}

View File

@@ -1,42 +1,11 @@
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(
HttpException.createBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
createHttpExceptionBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
HttpStatus.UNPROCESSABLE_ENTITY,
);
}

View File

@@ -1,45 +1,14 @@
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(
HttpException.createBody(
createHttpExceptionBody(
message,
error,
HttpStatus.UNSUPPORTED_MEDIA_TYPE,

View File

@@ -15,7 +15,6 @@ export {
Abstract,
ArgumentMetadata,
ArgumentsHost,
BeforeApplicationShutdown,
CallHandler,
CanActivate,
DynamicModule,

View File

@@ -1,3 +0,0 @@
export interface BeforeApplicationShutdown {
beforeApplicationShutdown(signal?: string): any;
}

View File

@@ -1,19 +1,5 @@
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;
}

View File

@@ -1,20 +1,6 @@
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>;
}

View File

@@ -1,20 +1,5 @@
import { ArgumentsHost } from '../features/arguments-host.interface';
/**
* Interface describing implementation of a Web Sockets exception filter.
*
* @see [Exception Filters](https://docs.nestjs.com/websockets/exception-filters)
*
* @publicApi
*/
export interface WsExceptionFilter<T = any> {
/**
* Method to implement a custom (web sockets) 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): any;
*/
catch(exception: T, host: ArgumentsHost): any;
}

Some files were not shown because too many files have changed in this diff Show More