mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 23:41:40 +00:00
Compare commits
1 Commits
feat/allow
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbf3e39684 |
@@ -1,225 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
parameters:
|
||||
check-legacy-node-version:
|
||||
type: boolean
|
||||
default: false
|
||||
legacy-node-version:
|
||||
type: string
|
||||
default: '14.21.3'
|
||||
maintenance-node-version:
|
||||
type: string
|
||||
default: '16.20'
|
||||
active-node-version:
|
||||
type: string
|
||||
default: '18.17'
|
||||
current-node-version:
|
||||
type: string
|
||||
default: '20.5'
|
||||
|
||||
aliases:
|
||||
- &restore-cache
|
||||
restore_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- &save-cache
|
||||
save_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- &install-deps
|
||||
run:
|
||||
name: Install dependencies
|
||||
command: npm ci --legacy-peer-deps
|
||||
- &build-packages
|
||||
run:
|
||||
name: Build
|
||||
command: npm run build
|
||||
- &run-unit-tests
|
||||
run:
|
||||
name: Test
|
||||
command: npm run test
|
||||
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Update NPM version
|
||||
command: 'sudo npm install -g npm@^9'
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- *save-cache
|
||||
- *build-packages
|
||||
|
||||
test:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: cimg/node:<< parameters.node-version >>
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
and:
|
||||
- equal:
|
||||
[
|
||||
'<< parameters.node-version >>',
|
||||
'<< pipeline.parameters.legacy-node-version >>',
|
||||
]
|
||||
- not: << pipeline.parameters.check-legacy-node-version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Skip
|
||||
command: |
|
||||
echo Skipping
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- not:
|
||||
equal:
|
||||
[
|
||||
'<< parameters.node-version >>',
|
||||
'<< pipeline.parameters.legacy-node-version >>',
|
||||
]
|
||||
- << pipeline.parameters.check-legacy-node-version >>
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- *build-packages
|
||||
- when:
|
||||
condition:
|
||||
equal:
|
||||
[
|
||||
'<< parameters.node-version >>',
|
||||
'<< pipeline.parameters.maintenance-node-version >>',
|
||||
]
|
||||
steps:
|
||||
- run:
|
||||
name: Test (coverage)
|
||||
command: npm run test:cov
|
||||
- run:
|
||||
name: Collect coverage
|
||||
command: npm run coverage
|
||||
- store_artifacts:
|
||||
path: coverage
|
||||
- when:
|
||||
condition:
|
||||
not:
|
||||
equal:
|
||||
[
|
||||
'<< parameters.node-version >>',
|
||||
'<< pipeline.parameters.maintenance-node-version >>',
|
||||
]
|
||||
steps:
|
||||
- *run-unit-tests
|
||||
|
||||
lint:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
|
||||
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 << pipeline.parameters.maintenance-node-version >>
|
||||
node -v
|
||||
nvm alias default << pipeline.parameters.maintenance-node-version >>
|
||||
- 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 test:integration
|
||||
|
||||
codechecks_benchmarks:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- *build-packages
|
||||
- run:
|
||||
name: Install native wrk
|
||||
command: .circleci/install-wrk.sh
|
||||
- run:
|
||||
name: Run codechecks with benchmarks
|
||||
command: yarn codechecks:benchmarks
|
||||
|
||||
samples:
|
||||
working_directory: ~/nest
|
||||
docker:
|
||||
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
|
||||
environment:
|
||||
DISABLE_OPENCOLLECTIVE: 'true'
|
||||
steps:
|
||||
- checkout
|
||||
- *restore-cache
|
||||
- *install-deps
|
||||
- run:
|
||||
name: Build all samples
|
||||
command: npm run build:samples
|
||||
|
||||
workflows:
|
||||
build-and-test:
|
||||
jobs:
|
||||
- build
|
||||
- test:
|
||||
requires:
|
||||
- build
|
||||
matrix:
|
||||
parameters:
|
||||
node-version:
|
||||
[
|
||||
'<< pipeline.parameters.legacy-node-version >>',
|
||||
'<< pipeline.parameters.maintenance-node-version >>',
|
||||
'<< pipeline.parameters.active-node-version >>',
|
||||
'<< pipeline.parameters.current-node-version >>',
|
||||
]
|
||||
- lint:
|
||||
requires:
|
||||
- build
|
||||
- integration_tests:
|
||||
requires:
|
||||
- build
|
||||
- samples:
|
||||
requires:
|
||||
- build
|
||||
- codechecks_benchmarks:
|
||||
requires:
|
||||
- build
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# based on https://medium.com/@felipedutratine/intelligent-benchmark-with-wrk-163986c1587f
|
||||
|
||||
cd /tmp/
|
||||
sudo apt-get install build-essential libssl-dev git -y
|
||||
git clone --depth=1 https://github.com/wg/wrk.git wrk
|
||||
cd wrk
|
||||
sudo make
|
||||
# move the executable to somewhere in your PATH, ex:
|
||||
sudo cp wrk /usr/local/bin
|
||||
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"extends": ["@commitlint/config-angular"],
|
||||
"rules": {
|
||||
"subject-case": [
|
||||
2,
|
||||
"always",
|
||||
["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"]
|
||||
],
|
||||
"type-enum": [
|
||||
2,
|
||||
"always",
|
||||
[
|
||||
"build",
|
||||
"chore",
|
||||
"ci",
|
||||
"docs",
|
||||
"feat",
|
||||
"fix",
|
||||
"perf",
|
||||
"refactor",
|
||||
"revert",
|
||||
"style",
|
||||
"test",
|
||||
"sample"
|
||||
]
|
||||
],
|
||||
"scope-enum": [
|
||||
1,
|
||||
"always",
|
||||
[
|
||||
"common",
|
||||
"core",
|
||||
"sample",
|
||||
"microservices",
|
||||
"express",
|
||||
"fastify",
|
||||
"socket.io",
|
||||
"ws",
|
||||
"testing",
|
||||
"websockets"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
**/node_modules/**
|
||||
*.d.ts
|
||||
*.js
|
||||
47
.eslintrc.js
47
.eslintrc.js
@@ -1,47 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.spec.ts', 'integration/**/*.ts'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.spec.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,2 +0,0 @@
|
||||
package-lock.json -diff -merge
|
||||
package-lock.json linguist-generated=true
|
||||
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,4 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [kamilmysliwiec]
|
||||
open_collective: nest
|
||||
46
.github/ISSUE_TEMPLATE.md
vendored
Normal file
46
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
|
||||
|
||||
ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
|
||||
-->
|
||||
|
||||
## I'm submitting a...
|
||||
<!--
|
||||
Please search GitHub for a similar issue or PR before submitting.
|
||||
Check one of the following options with "x" -->
|
||||
<pre><code>
|
||||
[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->
|
||||
[ ] Bug report
|
||||
[ ] Feature request
|
||||
[ ] Documentation issue or request
|
||||
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
|
||||
</code></pre>
|
||||
|
||||
## Current behavior
|
||||
<!-- Describe how the issue manifests. -->
|
||||
|
||||
|
||||
## Expected behavior
|
||||
<!-- Describe what the desired behavior would be. -->
|
||||
|
||||
|
||||
## Minimal reproduction of the problem with instructions
|
||||
<!-- Please share a repo, a gist, or step-by-step instructions. -->
|
||||
|
||||
## What is the motivation / use case for changing the behavior?
|
||||
<!-- Describe the motivation or the concrete use case. -->
|
||||
|
||||
|
||||
## Environment
|
||||
|
||||
<pre><code>
|
||||
Nest version: X.Y.Z
|
||||
<!-- Check whether this is still an issue in the most recent Nest version -->
|
||||
|
||||
For Tooling issues:
|
||||
- Node version: XX <!-- run `node --version` -->
|
||||
- Platform: <!-- Mac, Linux, Windows -->
|
||||
|
||||
Others:
|
||||
<!-- Anything else relevant? Operating system version, IDE, package manager, ... -->
|
||||
</code></pre>
|
||||
146
.github/ISSUE_TEMPLATE/Bug_report.yml
vendored
146
.github/ISSUE_TEMPLATE/Bug_report.yml
vendored
@@ -1,146 +0,0 @@
|
||||
name: "\U0001F41B Bug Report"
|
||||
description: "If something isn't working as expected \U0001F914"
|
||||
labels: ["needs triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
|
||||
|
||||
If you are not sure that your issue is a bug, you could:
|
||||
|
||||
- read the [FAQ's common errors](https://docs.nestjs.com/faq/common-errors) page
|
||||
- use our [Discord community](https://discord.gg/NestJS)
|
||||
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
|
||||
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
|
||||
|
||||
**NOTE:** You don't need to answer questions that you know that aren't relevant.
|
||||
|
||||
---
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "Is there an existing issue for this?"
|
||||
description: "Please search [here](../issues?q=is%3Aissue) to see if an issue already exists for the bug you encountered"
|
||||
options:
|
||||
- label: "I have searched the existing issues"
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Current behavior"
|
||||
description: "How the issue manifests?"
|
||||
|
||||
- type: input
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Minimum reproduction code"
|
||||
placeholder: "https://github.com/..."
|
||||
description: |
|
||||
An URL to some Git repository/[StackBlitz](https://stackblitz.com/fork/github/nestjs/typescript-starter)/[CodeSandbox](https://codesandbox.io/s/github/nestjs/typescript-starter/tree/master) project that reproduces your issue. [What is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)
|
||||
|
||||
> [!WARNING]
|
||||
> We may close this Issue if we don't manage to reproduce the potential bug. [Read this](https://antfu.me/posts/why-reproductions-are-required) to understand why.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Steps to reproduce"
|
||||
description: |
|
||||
How the issue manifests?
|
||||
You could leave this blank if you already write this in your reproduction code
|
||||
placeholder: |
|
||||
1. `npm ci`
|
||||
2. `npm start:dev`
|
||||
3. See error...
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Expected behavior"
|
||||
description: "A clear and concise description of what you expected to happened (or code)"
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
---
|
||||
|
||||
- type: checkboxes
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Package"
|
||||
description: |
|
||||
Which package (or packages) do you think your issue is related to?
|
||||
**Tip**: The first line of the stack trace can help you to figure out this
|
||||
|
||||
The package isn't listed below? Try to find its repository [here](https://github.com/orgs/nestjs/repositories) and open the issue there instead
|
||||
options:
|
||||
- label: "I don't know. Or some 3rd-party package"
|
||||
- label: "<code>@nestjs/common</code>"
|
||||
- label: "<code>@nestjs/core</code>"
|
||||
- label: "<code>@nestjs/microservices</code>"
|
||||
- label: "<code>@nestjs/platform-express</code>"
|
||||
- label: "<code>@nestjs/platform-fastify</code>"
|
||||
- label: "<code>@nestjs/platform-socket.io</code>"
|
||||
- label: "<code>@nestjs/platform-ws</code>"
|
||||
- label: "<code>@nestjs/testing</code>"
|
||||
- label: "<code>@nestjs/websockets</code>"
|
||||
- label: "Other (see below)"
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Other package"
|
||||
description: "If your issue is related to some package that is not listed above nor under @nestjs org, write its name here"
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "NestJS version"
|
||||
description: |
|
||||
Which version of `@nestjs/core` are you using?
|
||||
**Tip**: Make sure that all of yours `@nestjs/*` dependencies are in sync!
|
||||
placeholder: "8.1.3"
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Packages versions"
|
||||
description: |
|
||||
You could leave your whole `package.json` dependencies list here, or just indicate which version of `@nestjs/*` you are using
|
||||
**Tip**: run _npx nest info_
|
||||
value: |
|
||||
```json
|
||||
|
||||
```
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Node.js version"
|
||||
description: "Which version of Node.js are you using?"
|
||||
placeholder: "14.17.6"
|
||||
|
||||
- type: checkboxes
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "In which operating systems have you tested?"
|
||||
options:
|
||||
- label: macOS
|
||||
- label: Windows
|
||||
- label: Linux
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
---
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Other"
|
||||
description: |
|
||||
Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
|
||||
**Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in
|
||||
55
.github/ISSUE_TEMPLATE/Feature_request.yml
vendored
55
.github/ISSUE_TEMPLATE/Feature_request.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: "\U0001F680 Feature Request"
|
||||
description: "I have a suggestion \U0001F63B!"
|
||||
labels: ["type: enhancement :wolf:", "needs triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
|
||||
|
||||
If you are not sure that your issue is a bug, you could:
|
||||
|
||||
- read the [FAQ's common errors](https://docs.nestjs.com/faq/common-errors) page
|
||||
- use our [Discord community](https://discord.gg/NestJS)
|
||||
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
|
||||
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
|
||||
|
||||
---
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "Is there an existing issue that is already proposing this?"
|
||||
description: "Please search [here](../issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
|
||||
options:
|
||||
- label: "I have searched the existing issues"
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Is your feature request related to a problem? Please describe it"
|
||||
description: "A clear and concise description of what the problem is"
|
||||
placeholder: |
|
||||
I have an issue when ...
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Describe the solution you'd like"
|
||||
description: "A clear and concise description of what you want to happen. Add any considered drawbacks"
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Teachability, documentation, adoption, migration strategy"
|
||||
description: "If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design?"
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "What is the motivation / use case for changing the behavior?"
|
||||
description: "Describe the motivation or the concrete use case"
|
||||
84
.github/ISSUE_TEMPLATE/Regression.yml
vendored
84
.github/ISSUE_TEMPLATE/Regression.yml
vendored
@@ -1,84 +0,0 @@
|
||||
name: "\U0001F4A5 Regression"
|
||||
description: "Report an unexpected while upgrading your Nest application!"
|
||||
labels: ["type: bug :sob:", "needs triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
|
||||
|
||||
If you are not sure that your issue is a bug, you could:
|
||||
|
||||
- read the [FAQ's common errors](https://docs.nestjs.com/faq/common-errors) page
|
||||
- use our [Discord community](https://discord.gg/NestJS)
|
||||
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
|
||||
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
|
||||
|
||||
**NOTE:** You don't need to answer questions that you know that aren't relevant.
|
||||
|
||||
---
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "Did you read the migration guide?"
|
||||
description: "Check out the [migration guide here](https://docs.nestjs.com/migration-guide)!"
|
||||
options:
|
||||
- label: "I have read the whole migration guide"
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "Is there an existing issue that is already proposing this?"
|
||||
description: "Please search [here](../issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
|
||||
options:
|
||||
- label: "I have searched the existing issues"
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Potential Commit/PR that introduced the regression"
|
||||
description: "If you have time to investigate, what PR/date/version introduced this issue"
|
||||
placeholder: "PR #123 or commit 5b3c4a4"
|
||||
|
||||
- type: input
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "NestJS version"
|
||||
placeholder: "8.1.0 -> 8.1.3"
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Describe the regression"
|
||||
description: "A clear and concise description of what the regression is"
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Minimum reproduction code"
|
||||
description: "An URL to some git repository that reproduces this issue. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)"
|
||||
placeholder: "https://github.com/..."
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Input code"
|
||||
description: "Write some code snippets if you think it is worth it"
|
||||
value: |
|
||||
```ts
|
||||
|
||||
```
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Expected behavior"
|
||||
description: "A clear and concise description of what you expected to happened (or code)"
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Other"
|
||||
description: |
|
||||
Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
|
||||
**Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in
|
||||
@@ -1,48 +0,0 @@
|
||||
title: "perf: "
|
||||
name: "\U0001F525 Suggestion for Improving Performance"
|
||||
description: "I have a suggestion that might improve the performance of Nest \U00002728"
|
||||
labels: ["type: enhancement :wolf:", "needs triage"]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: "Is there an existing issue that is already proposing this?"
|
||||
description: "Please search [here](../issues?q=is%3Aissue) to see if an issue already exists for this"
|
||||
options:
|
||||
- label: "I have searched the existing issues"
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "NestJS version"
|
||||
description: "Which version do you intend to improve?"
|
||||
placeholder: "8.1.3"
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Is your performance suggestion related to a problem? Please describe it"
|
||||
description: "A clear and concise description of what the problem is"
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Describe the performance enhancement you are proposing and how we can try it out"
|
||||
placeholder: |
|
||||
Cache `array.length` on the following lines ...
|
||||
|
||||
- type: textarea
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "Benchmarks result or another proof (eg: POC)"
|
||||
description: |
|
||||
If you've already prototyped a solution, share your results here
|
||||
If not, what makes you believe there will be a performance improvement?
|
||||
placeholder: |
|
||||
```
|
||||
```
|
||||
|
||||
MacBook Pro Mid 2014, 2.5 GHz Quad-Core Intel Core i7, 16 GB 1600 MHz DDR3, SSD
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/config.yml
vendored
10
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,10 +0,0 @@
|
||||
## To encourage contributors to use issue templates, we don't allow blank issues
|
||||
blank_issues_enabled: false
|
||||
|
||||
contact_links:
|
||||
- name: "\u2049 FAQ"
|
||||
url: "https://docs.nestjs.com/faq"
|
||||
about: "Make sure you have read the Frequently Asked Questions page."
|
||||
- name: "\u2753 Discord Community of NestJS"
|
||||
url: "https://discord.gg/NestJS"
|
||||
about: "Please ask support questions or discuss suggestions/enhancements here."
|
||||
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,37 +0,0 @@
|
||||
## PR Checklist
|
||||
Please check if your PR fulfills the following requirements:
|
||||
|
||||
- [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features)
|
||||
- [ ] Docs have been added / updated (for bug fixes / features)
|
||||
|
||||
|
||||
## PR Type
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
<!-- Please check the one that applies to this PR using "x". -->
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting, local variables)
|
||||
- [ ] Refactoring (no functional changes, no api changes)
|
||||
- [ ] Build related changes
|
||||
- [ ] CI related changes
|
||||
- [ ] Other... Please describe:
|
||||
|
||||
## What is the current behavior?
|
||||
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
|
||||
## Does this PR introduce a breaking change?
|
||||
- [ ] Yes
|
||||
- [ ] No
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
|
||||
|
||||
|
||||
## Other information
|
||||
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@@ -1,12 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
36
.github/lock.yml
vendored
36
.github/lock.yml
vendored
@@ -1,36 +0,0 @@
|
||||
# Number of days of inactivity before a closed issue or pull request is locked
|
||||
daysUntilLock: 90
|
||||
|
||||
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||
skipCreatedBefore: false
|
||||
|
||||
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||
exemptLabels: []
|
||||
|
||||
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||
lockLabel: false
|
||||
|
||||
# Comment to post before locking. Set to `false` to disable
|
||||
lockComment: >
|
||||
This thread has been automatically locked since there has not been
|
||||
any recent activity after it was closed. Please open a new issue for
|
||||
related bugs.
|
||||
|
||||
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||
setLockReason: true
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
# only: issues
|
||||
|
||||
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - help-wanted
|
||||
# lockLabel: outdated
|
||||
|
||||
# pulls:
|
||||
# daysUntilLock: 30
|
||||
|
||||
# Repository to extend settings from
|
||||
# _extends: repo
|
||||
61
.github/workflows/codeql-analysis.yml
vendored
61
.github/workflows/codeql-analysis.yml
vendored
@@ -1,61 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '0 17 * * 4'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
permissions:
|
||||
security-events: write
|
||||
name: Analyse
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
queries: +security-extended
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
36
.gitignore
vendored
36
.gitignore
vendored
@@ -1,38 +1,22 @@
|
||||
packages/*/package-lock.json
|
||||
|
||||
# dependencies
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
# IDE
|
||||
/.idea
|
||||
/.awcache
|
||||
/.vscode
|
||||
/.devcontainer
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
*.code-workspace
|
||||
|
||||
# Vim
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# bundle
|
||||
packages/**/*.d.ts
|
||||
packages/**/*.js
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
lerna-debug.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/**/npm-debug.log
|
||||
/packages/**/.npmignore
|
||||
/packages/**/LICENSE
|
||||
*.tsbuildinfo
|
||||
/src/common/npm-debug.log
|
||||
/src/core/npm-debug.log
|
||||
/src/testing/npm-debug.log
|
||||
/src/microservices/npm-debug.log
|
||||
/src/websockets/npm-debug.log
|
||||
|
||||
# example
|
||||
/quick-start
|
||||
@@ -41,12 +25,6 @@ yarn-error.log
|
||||
|
||||
# tests
|
||||
/test
|
||||
/benchmarks/memory
|
||||
/coverage
|
||||
/.nyc_output
|
||||
/packages/graphql
|
||||
/benchmarks/memory
|
||||
build/config\.gypi
|
||||
|
||||
.npmrc
|
||||
pnpm-lock.yaml
|
||||
build/config\.gypi
|
||||
@@ -1 +0,0 @@
|
||||
npx --no-install commitlint --edit $1
|
||||
@@ -1 +0,0 @@
|
||||
npx lint-staged
|
||||
15
.npmignore
15
.npmignore
@@ -1,15 +0,0 @@
|
||||
# source
|
||||
**/*.ts
|
||||
*.ts
|
||||
|
||||
# definitions
|
||||
!**/*.d.ts
|
||||
!*.d.ts
|
||||
|
||||
# configuration
|
||||
package-lock.json
|
||||
tslint.json
|
||||
tsconfig.json
|
||||
.prettierrc
|
||||
|
||||
*.tsbuildinfo
|
||||
@@ -1,3 +1 @@
|
||||
packages/**/*.d.ts
|
||||
packages/**/*.js
|
||||
.nyc_output
|
||||
/bundle
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"arrowParens": "avoid",
|
||||
"trailingComma": "all"
|
||||
}
|
||||
}
|
||||
14
.travis.yml
Normal file
14
.travis.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "7"
|
||||
addons:
|
||||
firefox: "latest"
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
install:
|
||||
- npm install
|
||||
- gulp build
|
||||
script:
|
||||
- npm test
|
||||
after_success: npm run coverage
|
||||
421
CHANGELOG.md
Normal file
421
CHANGELOG.md
Normal file
@@ -0,0 +1,421 @@
|
||||
## 5.0.0-beta.3
|
||||
### Bug Fixes
|
||||
- **core**: incorrect `ExpressAdapter` method wrappers [#585](https://github.com/nestjs/nest/issues/585)
|
||||
- **core**: the `fastify-formbody` is no longer a required dependency [#575](https://github.com/nestjs/nest/issues/575)
|
||||
- **core**: incorrect `createApplication()` typings (unable to pass express instance directly) [#575](https://github.com/nestjs/nest/issues/575)
|
||||
|
||||
## 5.0.0-beta.0
|
||||
### Features
|
||||
- **core**: support async lifecycle hooks (`OnModuleInit` and `OnModuleDestroy`) [#569](https://github.com/nestjs/nest/issues/569)
|
||||
- **core**: HTTP server independence, [fastify](https://github.com/fastify/fastify) integration (`FastifyAdapter`)
|
||||
- **core**: allow binding global interceptors, filters, pipes, and guards from any module. Example:
|
||||
```typescript
|
||||
{
|
||||
provide: APP_INTERCEPTOR,
|
||||
useClass: LoggerInterceptor,
|
||||
}
|
||||
```
|
||||
- **core**: `@UseGuards()`, `@UsePipes()`, `@UseFilters()`, and `@UseInterceptors()` extend metadata, instead of overriding existing one
|
||||
- **core**: dependency injection everywhere (pipes, filters, interceptors, and guards)
|
||||
- **core**: pass `ArgumentsHost` to exception filters (ability to access each argument)
|
||||
- **core**: pass enhanced `ExecutionContext` to both interceptors and guards (ability to access each argument and execution context)
|
||||
- **microservices**: improve existing transporters (TCP, Redis), provide new strategies: Nats, MQTT, gRPC
|
||||
|
||||
### Bug Fixes
|
||||
- **common**: incorrent `multer` dependency [#532](https://github.com/nestjs/nest/issues/532)
|
||||
- **core**: hanging `NestApplicationContext` process [#503](https://github.com/nestjs/nest/issues/503)
|
||||
- **microservices**: concurrency issues (both TCP and Redis transporters) [#505](https://github.com/nestjs/nest/issues/505)
|
||||
|
||||
### Improvements
|
||||
- **all**: remove `reflect-metadata` peer dependency [#563](https://github.com/nestjs/nest/issues/563)
|
||||
- **all**: upgrade RxJS (make use of pipeable operators)
|
||||
- **core**: more descriptive exceptions (circular dependency) [#493](https://github.com/nestjs/nest/issues/493)
|
||||
- **core**: Nest container compatible with `useContainer()` (`class-validator` and `typeorm` packages) [#528](https://github.com/nestjs/nest/issues/528)
|
||||
- **core**: remove static dependencies (webpack compatibility)
|
||||
- **websockets**: `@WebSocketGateway()` takes options argument that is passed to socket.io instance [#508](https://github.com/nestjs/nest/issues/508)
|
||||
|
||||
### Deprecations
|
||||
- **common**: deprecate `@Component()`, `@Middleware()`, `@Interceptor()`, `@Pipe()`, and `@Guard()` decorators (use `@Injectable()` instead)
|
||||
- **core**: deprecate `modules: []` property (use `imports: []` instead)
|
||||
- **core**: deprecate `components: []` property (use `providers: []` instead)
|
||||
|
||||
### Notes
|
||||
- move from traditional express middleware model: each middleware is solely bounded to a particular path, regardless of the request method
|
||||
|
||||
## 4.6.6
|
||||
### Bug Fixes:
|
||||
- **common**: `File(s)Interceptor` throws http status code 500 [#465](https://github.com/nestjs/nest/issues/437)
|
||||
- **core**: e2e testing, `EXPRESS_REF` injector issue [#484](https://github.com/nestjs/nest/issues/484)
|
||||
- **microservices**: `NO_PATTERN_MESSAGE` bugfix [#491](https://github.com/nestjs/nest/issues/491)
|
||||
|
||||
### Improvements:
|
||||
- **common**: `class-transformer` update [#483](https://github.com/nestjs/nest/pull/483/)
|
||||
- **common**: `HttpService` improvements, remove duplicated `axios` interfaces [#470](https://github.com/nestjs/nest/pull/470)
|
||||
- **core**: far more meaningful exception when not available component is exported (module inconsistency) [#479](https://github.com/nestjs/nest/issues/479)
|
||||
|
||||
## 4.6.5
|
||||
### Bug Fixes
|
||||
- **common**: `File(s)Interceptor` does not populate thrown exception [#437](https://github.com/nestjs/nest/issues/437)
|
||||
- **core**: `NestFactory.create()` returns `any`
|
||||
- **core**: use `ApplicationConfig` within `ExternalContextCreator` [#434](https://github.com/nestjs/nest/issues/434)
|
||||
|
||||
### Improvements
|
||||
- **common**: `HttpException` extends `Error`
|
||||
- **core**: make `cors` middleware customizable (`enableCors()`, `{ cors }`) [#457](https://github.com/nestjs/nest/issues/437)
|
||||
- **microservices**: `RpcException` extends `Error`
|
||||
- **websockets**: `WsException` extends `Error`
|
||||
|
||||
## 4.6.4
|
||||
### Bug Fixes
|
||||
- **common**: logger overrides custom logger scope [#435](https://github.com/nestjs/nest/issues/435)
|
||||
- **common**: `FileInterceptor` supports only one options at once [#429](https://github.com/nestjs/nest/issues/429)
|
||||
- **common**: support `symbol` as a token (`NestApplicationContext`)
|
||||
- **core**: fix exception handler (exceception thrown in the `done()` callback) [#431](https://github.com/nestjs/nest/issues/431)
|
||||
- **core**: incorrect HTTP response on `SyntaxError` [#430](https://github.com/nestjs/nest/issues/430)
|
||||
- **microservices**: can't select/get from context when using `NestFactory.createMicroservice` [#398](https://github.com/nestjs/nest/issues/398)
|
||||
|
||||
## 4.6.3
|
||||
### Bug Fixes
|
||||
- **core**: error thrown when connecting to microservice (hybrid applicaton) [#425](https://github.com/nestjs/nest/issues/425)
|
||||
|
||||
## 4.6.2
|
||||
### Improvements
|
||||
- **core**: simplify `NestFactory.create(...args)` signature
|
||||
|
||||
## 4.6.1
|
||||
### Improvements
|
||||
- **common**: create `ModuleMetadata` interface
|
||||
- **core**: majority of methods (`INestApplication`, `INestMicroservice`, and `INestApplicationContext`) return `this` instead of `void`
|
||||
- **core**: remove static dependencies & relationships inside `NestFactory`
|
||||
|
||||
### Features
|
||||
- **core**: [feature] add `appOptions` property to `create[..]` methods of `NestFactory`
|
||||
|
||||
### Bug Fixes
|
||||
- **common**: [bugfix] update `class-validator` [#417](https://github.com/nestjs/nest/issues/417)
|
||||
- **core**: [bugfix] catch error thrown by `bodyParser` in exception filter [#422](https://github.com/nestjs/nest/issues/422)
|
||||
|
||||
## 4.6.0
|
||||
### Features
|
||||
- **common**: `ValidationPipe` improvements [#383](https://github.com/nestjs/nest/pull/383)
|
||||
- **common**: `ParseIntPipe` improvements [#385](https://github.com/nestjs/nest/pull/385)
|
||||
- **common**: add `FileInterceptor`, `FilesInterceptor`, `@UploadedFile()` and `@UploadedFiles()` (`multer` integration)
|
||||
- **common**: add `HttpModule` that exposes `HttpService` (`axios` integration)
|
||||
- **core**: add `app.disable()` and `app.enable()` wrappers around `express` app
|
||||
- **core**: add ability to inject `express` reference (`EXPRESS_REF` token)
|
||||
- **core**: enable possibility to extend metadata (inheritance support) [#228](https://github.com/nestjs/nest/issues/228)
|
||||
- **core**: `NestFactory.create()` now accepts third argument `HttpsOptions`
|
||||
- **core**: add `app.enableCors()` to `INestApplication` (`cors` integration)
|
||||
- **core**: add `@Render()` decorator (MVC applications)
|
||||
- **core**: provide `Logger.overrideLogger()` [#247](https://github.com/nestjs/nest/issues/247)
|
||||
- **microservices**: add `listenAsync()` to `INestMicroservice` instance
|
||||
|
||||
### Bug Fixes
|
||||
- **core**: simplify HTTPS protocol usage
|
||||
- **core**: custom transport strategy - thrown exceptions issue [#290](https://github.com/nestjs/nest/issues/290)
|
||||
- **core**: injector fails silently [#287](https://github.com/nestjs/nest/issues/287)
|
||||
- **core**: secure websockets (`wss://`) [#384](https://github.com/nestjs/nest/issues/384)
|
||||
- **core**: can't select/get from context when using `NestFactory.createMicroservice()` [#398](https://github.com/nestjs/nest/issues/398)
|
||||
- **core**: interceptor `$stream` observable returns another observable instead of the response object [#376](https://github.com/nestjs/nest/issues/376)
|
||||
- **core**: `Observable.throw` from controller results in unhandled rejection promise [#373](https://github.com/nestjs/nest/issues/373)
|
||||
|
||||
## 4.5.10
|
||||
- **core**: [bugfix] #343
|
||||
- **core**: [bugfix] #337
|
||||
|
||||
## 4.5.6
|
||||
- **core**: [bugfix] dynamic modules `exports`
|
||||
|
||||
## 4.5.5
|
||||
- **core**: [bugfix] add missing `app.engine()` wrapper
|
||||
|
||||
## 4.5.4
|
||||
- **core**: [bugfix] dynamic modules recurrent imports fix
|
||||
|
||||
## 4.5.3
|
||||
- **testing**: [bugfix] issue #326
|
||||
|
||||
## 4.5.2
|
||||
- **common**: [feature] rename `modules` to `imports` (`@Module()` decorator)
|
||||
- **core**: [feature] exception filters with empty `@Catch()` metadata handle each occurred exception
|
||||
- **core**: [improvement] increase performance
|
||||
|
||||
## 4.5.1
|
||||
- **common**: [feature] `INestAplication` provides a `getHttpServer()` method now
|
||||
- **websockets**: [bugfix] `IoAdapter` bugfix
|
||||
|
||||
## 4.5.0
|
||||
- **common**: bugfix #286
|
||||
- **core**: dynamic modules feature
|
||||
- **core**: global scope feature
|
||||
- **core**: `ExternalContextCreator` & `ModulesContainer`
|
||||
- **core**: merge `NestApplicationContext` with `NestApplication`
|
||||
- **core**: `NotFoundException` is thrown when route is not available #298
|
||||
- **core**: add `set()` wrapper around native express methods
|
||||
- **core**: bugfix #281
|
||||
- **websockets**: bugfix #271
|
||||
- **microservices**: log RPC exceptions #303
|
||||
- **microservices**: merge `NestApplicationContext` with `NestMicroservice`
|
||||
- **microservices**: handle ECONNREFUSED #288
|
||||
|
||||
## 4.4.1
|
||||
- **common**: `ValidationPipe` improvement
|
||||
- **common**: custom route params decorators accepts pipes now
|
||||
- **core**: bugfix #268
|
||||
|
||||
## 4.4.0
|
||||
- **core**: possibility to create the `NestApplicationContext` using `NestFactory.createApplicationContext()` (Nest application without HTTP server / microservice in the background)
|
||||
- **core**: create custom params decorators feature (`createRouteParamDecorator()`)
|
||||
|
||||
## 4.3.3
|
||||
- **common**: `ParseIntPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **common**: package contains a set of useful HTTP exceptions now, such as `ForbiddenException`, `UnauthorizedException`, `BadRequestException` etc
|
||||
- **core**: `HttpException` was moved to `@nestjs/common`. This one from `core` packages is now DEPRECATED and will be removed in the next MAJOR release
|
||||
|
||||
## 4.3.0
|
||||
- **common**: `ValidationPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **core**: `json` and `urlencoded` (`body-parser`) middleware are applied by default now, bugfix #252
|
||||
- **core** more informative error message (injector) #223
|
||||
example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService (+, +, ?, +, +, +). Please verify whether [2] argument is available in the current context.`
|
||||
- **core**: bugfix #240 - middleware container state
|
||||
- **core**: bugifx #257 - `@Next()` issue
|
||||
- **testing**: testing module is now independent from `@nestjs/microservices`
|
||||
|
||||
## 4.2.2
|
||||
- **websockets**: bugfix #242
|
||||
|
||||
## 4.2.1
|
||||
- **core**: IoAdapter bugfix
|
||||
|
||||
## 4.2.0
|
||||
- **core**: log controller prefix #153
|
||||
- **websockets**: gateway listen the same port as the app #126
|
||||
|
||||
## 4.1.4
|
||||
- **common**: remove deprecated `@ExceptionFilters()` decorator
|
||||
- **core**: update to latest **express* version (4.16.2)
|
||||
- **core**: bugfix #187
|
||||
- **core**: bugfix #185
|
||||
- **all**: packages codependency refactor
|
||||
- **all**: add *lerna* package
|
||||
|
||||
## 4.1.3
|
||||
- **core**: forward reference bugfixes & security updates
|
||||
|
||||
## 4.1.1
|
||||
- **common**: add `forwardRef()` util
|
||||
- **core**: improve injector & dependencies scanner
|
||||
|
||||
## 4.1.0
|
||||
- **common**: add `@Bind()` and `@Dependencies()` decorators to fix route parameters decorators (pure JavaScript compatibility issue)
|
||||
- **core**: improve performance
|
||||
|
||||
## 4.0.1
|
||||
- **core**: add possibility to setup global guards and global interceptors
|
||||
- **common**: `INestApplication` has `useGlobalInterceptors()` and `useGlobalGuards()` now
|
||||
- **microservices**: add possibility to setup global guards, interceptors, filters and pipes
|
||||
- **core**: add timestamp to log output
|
||||
- **core**: improve pipes performance
|
||||
- **core**: add ability to omit param name when passing param-scoped pipe/s
|
||||
- **websockets**: fix disconnect event issue (pass client instead of socket.io instance)
|
||||
|
||||
## 4.0.0
|
||||
**@nestjs/core**
|
||||
- Asynchronous `NestFactory` [read more](http://www.docs.nestjs.com/first-steps)
|
||||
- New response handling approach [read more](http://www.docs.nestjs.com/controllers)
|
||||
- Interceptors feature [read more](http://www.docs.nestjs.com/interceptors)
|
||||
- `@Shared()` deprecated (modules are singletons by default) [read more](http://www.docs.nestjs.com/modules)
|
||||
- `@SingleScope()` decorator [read more](http://www.docs.nestjs.com/modules)
|
||||
- Modules re-exporting [read more](http://www.docs.nestjs.com/modules)
|
||||
- Deffered & functional middleware [read more](http://www.docs.nestjs.com/middleware)
|
||||
- Guards feature [read more](http://www.docs.nestjs.com/guards)
|
||||
- Async components [read more](http://www.docs.nestjs.com/advanced/async-components)
|
||||
- Hierarchical injector improvements [read more](http://www.docs.nestjs.com/advanced/hierarchical-injector)
|
||||
- Mixin classes [read more](http://www.docs.nestjs.com/advanced/mixins)
|
||||
- New `INestApplication` API
|
||||
|
||||
**@nestjs/microservices**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/microservices/basics)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
|
||||
|
||||
**@nestjs/websockets**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/websockets/gateways)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
- New `WebSocketAdapter` API
|
||||
|
||||
**@nestjs/testing**
|
||||
- Completely rewritten testing package
|
||||
|
||||
## 3.0.1 (24.06.2017)
|
||||
**@nestjs/core**
|
||||
- Hierarchical injector bugfix,
|
||||
- Middleware `@UseFilters()` bugfix (#95).
|
||||
|
||||
**@nestjs/microservices**
|
||||
- TCP server / client bugfix (#91)
|
||||
|
||||
## 3.0.0 (03.06.2017)
|
||||
**@nestjs/common - BREAKING CHANGE**
|
||||
- You should now pass objects into `@UseFilters()` decorator instead of metatypes,
|
||||
- Exception Filters can't inject dependencies (they're not coupled with modules),
|
||||
- `@ExceptionFilters()` is deprecated, use `@UseFilters()` instead.
|
||||
- `INestApplication` has new methods - `useGlobalFilters()` and `useGlobalPipes()`,
|
||||
- New lifecycle hook - `OnModuleDestroy` interface.
|
||||
|
||||
**@nestjs/core**
|
||||
- `@Pipe()` feature (async & sync),
|
||||
- Exception Filters can have global, controller and method scope.
|
||||
|
||||
**@nestjs/websockets - BREAKING CHANGE**
|
||||
- Use `useWebSocketAdapter()` instead of `setIoAdapter()`,
|
||||
- You can port any WS library - just implement `WebSocketAdapter` (@nestjs/common).
|
||||
|
||||
**@nestjs/microservices - BREAKING CHANGE**
|
||||
- Now methods have to return `Observable`, and they receive only one argument `data`,
|
||||
- Microservices can return multiple values, but after emitting `Observable` has to be COMPLETED!
|
||||
- You can port any transport strategy instead of built-in Redis/TCP, just implement `CustomTransportStrategy`.
|
||||
|
||||
## 2.1.3 (27.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.1 (24.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**, **@nestjs/microservices**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.0 (22.05.2017)
|
||||
**@nestjs/common**, **@nestjs/core**
|
||||
- `INestApplication` has new methods now - `init()`, `setGlobalPrefix()`, `connectMicroservice()`, `close()`, `startAllMicroservices()`,
|
||||
- `INestMicroservice` has new method - `close()`
|
||||
|
||||
## 2.0.3 (15.05.2017)
|
||||
**@nestjs/common**
|
||||
- `Req()` (`Request()`) and `Res()` (`Response()`) aliases to avoid conflicts with express typings
|
||||
|
||||
## 2.0.0 (14.05.2017)
|
||||
|
||||
- **Hierarchical injector** improvements
|
||||
- `@Shared(token?: string)` decorator for **scoped**, shared Modules
|
||||
- Modules **are not singletons** anymore
|
||||
- Added `iterare` library for applying multiple transformations to a collection
|
||||
- `Logger` service is public,
|
||||
- Nest is now splitted into feature packages:
|
||||
```typescript
|
||||
@nestjs/core
|
||||
@nestjs/common
|
||||
@nestjs/microservices
|
||||
@nestjs/testing
|
||||
@nestjs/websockets
|
||||
```
|
||||
- `rxjs`, `redis` and `reflect-metadata` moved into `peerDependencies`
|
||||
- `@Patch()` support
|
||||
|
||||
## 1.0.0 (Final - 01.05.2017)
|
||||
|
||||
- Added **Gateway Middleware** support:
|
||||
|
||||
```
|
||||
@WebSocketGateway({
|
||||
port: 2000,
|
||||
middleware: [ChatMiddleware],
|
||||
})
|
||||
```
|
||||
Gateway Middleware example:
|
||||
```
|
||||
@Middleware()
|
||||
export class ChatMiddleware implements GatewayMiddleware {
|
||||
public resolve(): (socket, next) => void {
|
||||
return (socket, next) => {
|
||||
console.log('Authorization...');
|
||||
next();
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- New Gateway lifecycle interfaces `OnGatewayInit`, `OnGatewayConnection`, `OnGatewayDisconnect`
|
||||
- `@SubscribeMessage()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@SubscribeMessage('event')
|
||||
```
|
||||
|
||||
- `@Controller()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@Controller('users')
|
||||
```
|
||||
|
||||
- `HttpStatus` (`HttpStatus.OK` etc.) enumerator
|
||||
- **Route params decorators** support
|
||||
|
||||
```
|
||||
Request: () => ParameterDecorator
|
||||
Response: () => ParameterDecorator
|
||||
Next: () => ParameterDecorator
|
||||
Query: (property?: string) => ParameterDecorator
|
||||
Body: (property?: string) => ParameterDecorator
|
||||
Param: (property?: string) => ParameterDecorator
|
||||
Session: () => ParameterDecorator
|
||||
Headers: (property?: string) => ParameterDecorator
|
||||
```
|
||||
|
||||
- `MiddlewareBuilder` -> `MiddlewareConsumer`
|
||||
- **Exception Filters** support
|
||||
|
||||
```
|
||||
@ExceptionFilters(CustomExceptionFilter, NextExceptionFilter)
|
||||
export class UsersController {}
|
||||
```
|
||||
Exception filter example:
|
||||
|
||||
```
|
||||
export class CustomException {}
|
||||
|
||||
@Catch(CustomException)
|
||||
export class CustomExceptionFilter implements ExceptionFilter {
|
||||
public catch(exception, response) {
|
||||
response.status(500).json({
|
||||
message: 'Custom exception message.',
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
- Module injection support:
|
||||
|
||||
```
|
||||
export class UsersController {
|
||||
constructor(private module: UsersModule) {}
|
||||
}
|
||||
```
|
||||
|
||||
- `ModuleRef` support
|
||||
|
||||
## 1.0.0-RC7 (08.04.2017)
|
||||
|
||||
- MiddlewareBuilder: `use()` deprecated, use `apply()` instead
|
||||
- MiddlewareBuilder: new `apply()` method
|
||||
|
||||
## 1.0.0-RC4 (08.04.2017)
|
||||
|
||||
- Support for `@Post`, `@Get`, `@Delete`, `@Put`, `@All` decorators
|
||||
- Added ability to pass data to middleware metatypes
|
||||
|
||||
## 1.0.0-BETA-1 (23.03.2017)
|
||||
|
||||
- `@Inject` -> `@Dependencies`
|
||||
- `@Inject` decorator for custom constructor parameters
|
||||
- Custom providers support (useClass, useValue, useFactory)
|
||||
|
||||
## 1.0.0-ALPHA-23 (19.03.2017)
|
||||
|
||||
- Microservices support (TCP & Redis transports)
|
||||
- NestRunner -> NestFactory
|
||||
- Simplify application initialization & configuration
|
||||
- Added abillity to pass custom express instance
|
||||
- `@Inject` decorator for ES6+
|
||||
- SocketGateway -> WebSocketGateway
|
||||
- GatewayServer -> WebSocketServer
|
||||
@@ -1,76 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at support@nestjs.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
273
CONTRIBUTING.md
Executable file → Normal file
273
CONTRIBUTING.md
Executable file → Normal file
@@ -3,52 +3,47 @@
|
||||
We would love for you to contribute to Nest and help make it even better than it is
|
||||
today! As a contributor, here are the guidelines we would like you to follow:
|
||||
|
||||
<!--* [Code of Conduct](#coc)-->
|
||||
|
||||
- [Question or Problem?](#question)
|
||||
- [Issues and Bugs](#issue)
|
||||
- [Feature Requests](#feature)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Development Setup](#development)
|
||||
- [Coding Rules](#rules)
|
||||
- [Commit Message Guidelines](#commit)
|
||||
<!-- - [Signing the CLA](#cla) -->
|
||||
- [Code of Conduct](#coc)
|
||||
- [Question or Problem?](#question)
|
||||
- [Issues and Bugs](#issue)
|
||||
- [Feature Requests](#feature)
|
||||
- [Submission Guidelines](#submit)
|
||||
- [Coding Rules](#rules)
|
||||
- [Commit Message Guidelines](#commit)
|
||||
<!-- - [Signing the CLA](#cla) -->
|
||||
|
||||
<!-- ## <a name="coc"></a> Code of Conduct
|
||||
Help us keep Nest open and inclusive. Please read and follow our [Code of Conduct][coc]. -->
|
||||
|
||||
## <a name="question"></a> Got a Question or Problem?
|
||||
|
||||
**Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.** You've got much better chances of getting your question answered on [Stack Overflow][stackoverflow] where the questions should be tagged with tag `nestjs`.
|
||||
**Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.** You've got much better chances of getting your question answered on [Stack Overflow](https://stackoverflow.com/questions/tagged/nestjs) where the questions should be tagged with tag `nestjs`.
|
||||
|
||||
Stack Overflow is a much better place to ask questions since:
|
||||
|
||||
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
|
||||
|
||||
- questions and answers stay available for public viewing so your question / answer might help someone else
|
||||
- Stack Overflow's voting system assures that the best answers are prominently visible.
|
||||
|
||||
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
|
||||
|
||||
If you would like to chat about the question in real-time, you can reach out via [our discord channel][discord].
|
||||
If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
|
||||
|
||||
## <a name="issue"></a> Found a Bug?
|
||||
|
||||
If you find a bug in the source code, you can help us by
|
||||
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
|
||||
[submit a Pull Request](#submit-pr) with a fix.
|
||||
|
||||
## <a name="feature"></a> Missing a Feature?
|
||||
|
||||
You can _request_ a new feature by [submitting an issue](#submit-issue) to our GitHub
|
||||
Repository. If you would like to _implement_ a new feature, please submit an issue with
|
||||
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
|
||||
Repository. If you would like to *implement* a new feature, please submit an issue with
|
||||
a proposal for your work first, to be sure that we can use it.
|
||||
Please consider what kind of change it is:
|
||||
|
||||
- For a **Major Feature**, first open an issue and outline your proposal so that it can be
|
||||
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
|
||||
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
|
||||
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
|
||||
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
|
||||
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
|
||||
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
|
||||
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
|
||||
|
||||
## <a name="submit"></a> Submission Guidelines
|
||||
|
||||
@@ -69,57 +64,49 @@ A minimal reproduce scenario using a repository or Gist allows us to quickly con
|
||||
|
||||
<!-- We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it. -->
|
||||
|
||||
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced.
|
||||
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that don't have enough info to be reproduced.
|
||||
|
||||
You can file new issues by filling out our [new issue form](https://github.com/nestjs/nest/issues/new).
|
||||
|
||||
You can file new issues by filling out our [new issue form][new_issue].
|
||||
|
||||
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
|
||||
|
||||
Before you submit your Pull Request (PR) consider the following guidelines:
|
||||
|
||||
<!--
|
||||
To the first point
|
||||
|
||||
1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
|
||||
We cannot accept code without this.
|
||||
-->
|
||||
|
||||
1. Search [GitHub Pull Requests][gh_prs] for an open or closed PR
|
||||
that relates to your submission. You don't want to duplicate effort.
|
||||
1. Fork this repository.
|
||||
1. Search [GitHub](https://github.com/nestjs/nest/pulls) for an open or closed PR
|
||||
that relates to your submission. You don't want to duplicate effort.
|
||||
<!-- 1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
|
||||
We cannot accept code without this. -->
|
||||
1. Fork the nestjs/nest repo.
|
||||
1. Make your changes in a new git branch:
|
||||
|
||||
```shell
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
```shell
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
|
||||
1. Create your patch, **including appropriate test cases**.
|
||||
1. Follow our [Coding Rules](#rules).
|
||||
1. Run the full Nest test suite (see [common scripts](#common-scripts)),
|
||||
and ensure that all tests pass.
|
||||
1. Run the full Nest test suite, as described in the [developer documentation][dev-doc],
|
||||
and ensure that all tests pass.
|
||||
1. Commit your changes using a descriptive commit message that follows our
|
||||
[commit message conventions](#commit). Adherence to these conventions
|
||||
is necessary because release notes are automatically generated from these messages.
|
||||
[commit message conventions](#commit). Adherence to these conventions
|
||||
is necessary because release notes are automatically generated from these messages.
|
||||
|
||||
```shell
|
||||
git commit -a
|
||||
```
|
||||
|
||||
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
|
||||
```shell
|
||||
git commit -a
|
||||
```
|
||||
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
|
||||
|
||||
1. Push your branch to GitHub:
|
||||
|
||||
```shell
|
||||
git push origin my-fix-branch
|
||||
```
|
||||
```shell
|
||||
git push origin my-fix-branch
|
||||
```
|
||||
|
||||
1. In GitHub, send a pull request to `nestjs:master`.
|
||||
|
||||
- If we suggest changes then:
|
||||
|
||||
- Make the required updates.
|
||||
- Re-run the Nest test suites to ensure tests are still passing.
|
||||
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
* If we suggest changes then:
|
||||
* Make the required updates.
|
||||
* Re-run the Nest test suites to ensure tests are still passing.
|
||||
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
|
||||
```shell
|
||||
git rebase master -i
|
||||
@@ -133,89 +120,49 @@ 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
|
||||
```
|
||||
```shell
|
||||
git push origin --delete my-fix-branch
|
||||
```
|
||||
|
||||
- Check out the master branch:
|
||||
* Check out the master branch:
|
||||
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
```shell
|
||||
git checkout master -f
|
||||
```
|
||||
|
||||
- Delete the local branch:
|
||||
* Delete the local branch:
|
||||
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
```shell
|
||||
git branch -D my-fix-branch
|
||||
```
|
||||
|
||||
- Update your master with the latest upstream version:
|
||||
* Update your master with the latest upstream version:
|
||||
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
|
||||
## <a name="development"></a> Development Setup
|
||||
|
||||
You will need [Node.js](https://nodejs.org) version >= 10.13.0 (except for v13).
|
||||
|
||||
1. After cloning the repo, run:
|
||||
|
||||
```bash
|
||||
$ npm ci --legacy-peer-deps # (or yarn install)
|
||||
```
|
||||
|
||||
2. In order to prepare your environment run `prepare.sh` shell script:
|
||||
|
||||
```bash
|
||||
$ sh scripts/prepare.sh
|
||||
```
|
||||
|
||||
That will compile fresh packages and afterward, move them all to `sample` directories.
|
||||
|
||||
### <a name="common-scripts"></a>Commonly used NPM scripts
|
||||
|
||||
```bash
|
||||
# build all packages and move to "sample" directories
|
||||
$ npm run build
|
||||
|
||||
# run the full unit tests suite
|
||||
$ npm run test
|
||||
|
||||
# run integration tests
|
||||
# docker is required(!)
|
||||
$ sh scripts/run-integration.sh
|
||||
|
||||
# run linter
|
||||
$ npm run lint
|
||||
|
||||
# build all packages and put them near to their source .ts files
|
||||
$ npm run build:prod
|
||||
```
|
||||
```shell
|
||||
git pull --ff upstream master
|
||||
```
|
||||
|
||||
## <a name="rules"></a> Coding Rules
|
||||
|
||||
To ensure consistency throughout the source code, keep these rules in mind as you are working:
|
||||
|
||||
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
|
||||
<!--
|
||||
// We're working on auto-documentation.
|
||||
* All public API methods **must be documented**. (Details TBC). -->
|
||||
|
||||
- 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`).
|
||||
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
|
||||
**100 characters**. An automated formatter is available, see
|
||||
[DEVELOPER.md](docs/DEVELOPER.md#clang-format).
|
||||
|
||||
## <a name="commit"></a> Commit Message Guidelines
|
||||
|
||||
We have very precise rules over how our git commit messages can be formatted. This leads to **more
|
||||
readable messages** that are easy to follow when looking through the **project history**. But also,
|
||||
We have very precise rules over how our git commit messages can be formatted. This leads to **more
|
||||
readable messages** that are easy to follow when looking through the **project history**. But also,
|
||||
we use the git commit messages to **generate the Nest change log**.
|
||||
|
||||
### Commit Message Format
|
||||
|
||||
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
|
||||
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
|
||||
format that includes a **type**, a **scope** and a **subject**:
|
||||
|
||||
```
|
||||
@@ -228,79 +175,70 @@ format that includes a **type**, a **scope** and a **subject**:
|
||||
|
||||
The **header** is mandatory and the **scope** of the header is optional.
|
||||
|
||||
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
|
||||
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
|
||||
to read on GitHub as well as in various git tools.
|
||||
|
||||
Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
|
||||
|
||||
Samples: (even more [samples][commits_samples])
|
||||
Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
|
||||
|
||||
```
|
||||
docs(changelog): update change log to beta.5
|
||||
fix(core): need to depend on latest rxjs and zone.js
|
||||
```
|
||||
```
|
||||
fix(release): need to depend on latest rxjs and zone.js
|
||||
|
||||
The version in our package.json gets copied to the one we publish, and users need the latest of these.
|
||||
```
|
||||
|
||||
### Revert
|
||||
|
||||
If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||
|
||||
### Type
|
||||
|
||||
Must be one of the following:
|
||||
|
||||
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
- **chore**: Updating tasks etc; no production code change
|
||||
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
- **docs**: Documentation only changes
|
||||
- **feat**: A new feature
|
||||
- **fix**: A bug fix
|
||||
- **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
|
||||
- **sample**: A change to the samples
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **docs**: Documentation only changes
|
||||
* **feat**: A new feature
|
||||
* **fix**: A bug fix
|
||||
* **perf**: A code change that improves performance
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* **test**: Adding missing tests or correcting existing tests
|
||||
|
||||
### Scope
|
||||
|
||||
The scope should have the name of the npm package affected (as perceived by person reading changelog generated from commit messages).
|
||||
The scope should be the name of the npm package affected (as perceived by person reading changelog generated from commit messages.
|
||||
|
||||
The following is the list of supported scopes:
|
||||
|
||||
- **common**: for changes made on `packages/common` directory
|
||||
- **core**: for changes made on `packages/core` directory
|
||||
- **sample**: for changes made on `packages/sample` directory
|
||||
- **microservices**: for changes made on `packages/microservices` directory
|
||||
- **express**: for changes made on `packages/platform-express` directory
|
||||
- **fastify**: for changes made on `packages/platform-fastify` directory
|
||||
- **socket.io**: for changes made on `packages/platform-socket.io` directory
|
||||
- **ws**: for changes made on `packages/platform-ws` directory
|
||||
- **testing**: for changes made on `packages/testing` directory
|
||||
- **websockets**: for changes made on `packages/websockets` directory
|
||||
|
||||
If your change affect more than one package, separate the scopes with a comma (e.g. `common,core`).
|
||||
* **common**
|
||||
* **core**
|
||||
* **examples**
|
||||
* **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`)
|
||||
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
* **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
* **examples/#**: for the example apps directory, replacing # with the example app number
|
||||
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
|
||||
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
|
||||
|
||||
### Subject
|
||||
|
||||
The subject contains succinct description of the change:
|
||||
|
||||
- use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
- don't capitalize first letter
|
||||
- no dot (.) at the end
|
||||
* use the imperative, present tense: "change" not "changed" nor "changes"
|
||||
* don't capitalize first letter
|
||||
* no dot (.) at the end
|
||||
|
||||
### Body
|
||||
|
||||
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
|
||||
The body should include the motivation for the change and contrast this with previous behavior.
|
||||
|
||||
### Footer
|
||||
|
||||
The footer should contain any information about **Breaking Changes** and is also the place to
|
||||
reference GitHub issues that this commit **Closes**.
|
||||
|
||||
@@ -317,18 +255,17 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
|
||||
* For corporations we'll need you to
|
||||
[print, sign and one of scan+email, fax or mail the form][corporate-cla]. -->
|
||||
|
||||
|
||||
<!-- [angular-group]: https://groups.google.com/forum/#!forum/angular -->
|
||||
|
||||
<!-- [coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md -->
|
||||
|
||||
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
|
||||
<!-- [individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html -->
|
||||
<!-- [corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html -->
|
||||
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
|
||||
[dev-doc]: https://github.com/nestjs/nest/blob/master/docs/DEVELOPER.md
|
||||
[github]: https://github.com/nestjs/nest
|
||||
[stackoverflow]: https://stackoverflow.com/questions/tagged/nestjs
|
||||
[discord]: https://discordapp.com/invite/G7Qnnhy
|
||||
[gitter]: https://gitter.im/nestjs/nest
|
||||
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
|
||||
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
|
||||
[new_issue]: https://github.com/nestjs/nest/issues/new
|
||||
[gh_prs]: https://github.com/nestjs/nest/pulls
|
||||
[commits_samples]: https://github.com/nestjs/nest/commits/master
|
||||
[jsfiddle]: http://jsfiddle.net
|
||||
[plunker]: http://plnkr.co/edit
|
||||
[runnable]: http://runnable.com
|
||||
<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2017-2024 Kamil Mysliwiec <https://kamilmysliwiec.com>
|
||||
Copyright (c) 2017 Kamil Myśliwiec <http://kamilmysliwiec.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
190
Readme.md
190
Readme.md
@@ -1,151 +1,111 @@
|
||||
<p align="center">
|
||||
<a href="https://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[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="https://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/common.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://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>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#6" alt="Coverage" /></a>
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
Nest is a framework for building efficient, scalable <a href="https://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="https://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also provides compatibility with a wide range of other libraries, like <a href="https://github.com/fastify/fastify" target="_blank">Fastify</a>, allowing for easy use of the myriad of third-party plugins which are available.</p>
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a>, and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a>, which improve developer productivity and enable the construction of fast, testable, and extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers, and tools for Node, none of them effectively solve the main problem - the architecture.</p>
|
||||
<p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, and loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.</p>
|
||||
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a> and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a> which improve developer productivity and enable the construction of fast, testable, extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers and tools for Node, none of them effectively solve the main problem - the architecture.</p>
|
||||
<p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, loosely coupled and easily maintainable applications.</p>
|
||||
|
||||
## Getting started
|
||||
|
||||
- To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
- 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
||||
- [가이드](readme_kr.md) 문서는 [docs.nestjs.com](https://docs.nestjs.com)에서 확인하실 수 있습니다. :books:
|
||||
- [ガイド](readme_jp.md)は [docs.nestjs.com](https://docs.nestjs.com)でご確認ください。 :books:
|
||||
|
||||
## Questions
|
||||
|
||||
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
|
||||
|
||||
## Issues
|
||||
|
||||
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
|
||||
|
||||
## Consulting
|
||||
|
||||
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
|
||||
To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsors
|
||||
#### Principal Sponsor
|
||||
|
||||
<table style="text-align:center;">
|
||||
<tr>
|
||||
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
|
||||
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/logos/microsoft-logo.png" width="180" valign="middle" /></a></td>
|
||||
<td><a href="https://mojam.co" target="_blank"><img src="https://nestjs.com/img/logos/mojam-logo.png" width="80" valign="middle" /></a></td>
|
||||
<td><a href="https://marblism.com?utm_source=nest" target="_blank"><img src="https://nestjs.com/img/logos/marblism-logo.png" width="180" valign="middle" /></a></td>
|
||||
<td><a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td>
|
||||
<td><a href="https://amplication.com/" target="_blank"><img src="https://nestjs.com/img/logos/amplication-logo.svg" width="190" valign="middle" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Gold Sponsors
|
||||
|
||||
<table style="text-align:center;">
|
||||
<tr>
|
||||
<td><a href="https://www.redhat.com" target="_blank"><img src="https://nestjs.com/img/logos/red-hat-logo.svg" width="200" valign="middle" /></a></td>
|
||||
<td><a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td>
|
||||
<td><a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/logos/nx-logo.png" height="45" valign="middle" /></a></td>
|
||||
<td><a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/logos/intrinisic-logo.png" width="210" valign="middle" /></a></td>
|
||||
<td><a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/logos/jetbrains-logo.svg" width="90" valign="middle" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/logos/snyk-logo-black.png" width="185" valign="middle" /></a></td>
|
||||
<td><a href="https://fuseautotech.com/" target="_blank"><img src="https://nestjs.com/img/logos/fuse-logo.svg" width="105" valign="middle" /></a></td>
|
||||
<td><a href="https://ridicorp.com/career/" target="_blank"><img src="https://nestjs.com/img/logos/ridi-logo.svg" width="105" valign="middle" /></a></td>
|
||||
<td><a href="https://www.movavi.com/imovie-for-windows.html" target="_blank"><img src="https://nestjs.com/img/logos/movavi-logo.svg" width="105" valign="middle" /></a></td>
|
||||
<td><a href="https://skunk.team" target="_blank"><img src="https://nestjs.com/img/logos/skunk-logo.png" height="60" valign="middle" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
<table style="text-align:center;">
|
||||
<tr>
|
||||
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/logos/mercedes-logo.png" width="100" valign="middle" /></a></td>
|
||||
<td><a href="https://www.dinii.jp/" target="_blank"><img src="https://nestjs.com/img/logos/dinii-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td><a href="https://bloodycase.com/?promocode=NEST" target="_blank"><img src="https://nestjs.com/img/logos/bloodycase-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/logos/handsontable-dark-logo.svg#2" width="150" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/logos/it_flashcards-logo.png" width="170" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://arcjet.com/?ref=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/arcjet-logo.svg" width="170" valign="middle" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="middle"><a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/logos/swingdev-logo.svg#1" width="110" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/novologic.png" width="110" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/logos/mantro-logo.svg" width="95" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/logos/triplebyte.png" width="107" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/logos/nearpod-logo.svg" width="100" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/logos/genuinebee.svg" width="97" valign="middle" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/logos/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://lambda-it.ch/" target="_blank"><img src="https://nestjs.com/img/logos/lambda-it-logo.svg" width="115" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://rocketech.it/cases/?utm_source=google&utm_medium=badge&utm_campaign=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/rocketech-logo.svg" width="110" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.anonymistic.com/" target="_blank"><img src="https://nestjs.com/img/logos/anonymistic-logo.png" width="125" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/naologic-logo.svg" width="125" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/logos/triplecore-logo.svg" width="50" valign="middle" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle"><a href="https://thecasinowizard.com/bonuses/no-deposit-bonuses/" target="_blank"><img src="https://nestjs.com/img/logos/casinowizard-logo.png" width="120" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/logos/polygon-logo.svg" width="120" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/logos/boringowl-logo.svg" width="120" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://nordbot.app/" target="_blank"><img src="https://nestjs.com/img/logos/nordbot-logo.png" width="120" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://doppio.sh/" target="_blank"><img src="https://nestjs.com/img/logos/dopiosh-logo.png" width="50" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/logos/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/logos/julienferand-logo.jpeg" width="55" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/logos/tripoffice-logo.png" width="140" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://solcellsforetag.se/" target="_blank"><img src="https://nestjs.com/img/logos/solcellsforetag-logo.svg" width="140" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.route4me.com/" target="_blank"><img src="https://nestjs.com/img/logos/route4me-logo.svg" width="100" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.slotsup.com/" target="_blank"><img src="https://nestjs.com/img/logos/slotsup-logo.png" width="60" valign="middle" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="150" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></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/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/30/website" target="_blank"><img src="https://opencollective.com/nest/backer/30/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/31/website" target="_blank"><img src="https://opencollective.com/nest/backer/31/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/32/website" target="_blank"><img src="https://opencollective.com/nest/backer/32/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/33/website" target="_blank"><img src="https://opencollective.com/nest/backer/33/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/34/website" target="_blank"><img src="https://opencollective.com/nest/backer/34/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/35/website" target="_blank"><img src="https://opencollective.com/nest/backer/35/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/36/website" target="_blank"><img src="https://opencollective.com/nest/backer/36/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/37/website" target="_blank"><img src="https://opencollective.com/nest/backer/37/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/38/website" target="_blank"><img src="https://opencollective.com/nest/backer/38/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/39/website" target="_blank"><img src="https://opencollective.com/nest/backer/39/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/40/website" target="_blank"><img src="https://opencollective.com/nest/backer/40/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/41/website" target="_blank"><img src="https://opencollective.com/nest/backer/41/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/42/website" target="_blank"><img src="https://opencollective.com/nest/backer/42/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/43/website" target="_blank"><img src="https://opencollective.com/nest/backer/43/avatar.svg"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://x.com/kammysliwiec)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- X - [@nestframework](https://x.com/nestframework)
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report security issues to `support@nestjs.com`.
|
||||
@@ -1,88 +0,0 @@
|
||||
-----------------------
|
||||
express
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
1024 connections
|
||||
|
||||
┌─────────┬───────┬───────┬───────┬────────┬──────────┬──────────┬────────┐
|
||||
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
|
||||
├─────────┼───────┼───────┼───────┼────────┼──────────┼──────────┼────────┤
|
||||
│ Latency │ 55 ms │ 58 ms │ 91 ms │ 138 ms │ 61.88 ms │ 23.95 ms │ 747 ms │
|
||||
└─────────┴───────┴───────┴───────┴────────┴──────────┴──────────┴────────┘
|
||||
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬─────────┬─────────┐
|
||||
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼─────────┼─────────┤
|
||||
│ Req/Sec │ 8407 │ 8407 │ 17407 │ 17743 │ 16454.41 │ 2716.94 │ 8402 │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼─────────┼─────────┤
|
||||
│ Bytes/Sec │ 1.81 MB │ 1.81 MB │ 3.74 MB │ 3.81 MB │ 3.54 MB │ 584 kB │ 1.81 MB │
|
||||
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴─────────┴─────────┘
|
||||
|
||||
Req/Bytes counts sampled once per second.
|
||||
|
||||
165k requests in 10.17s, 35.4 MB read
|
||||
-----------------------
|
||||
nest (with "@nestjs/platform-express")
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
1024 connections
|
||||
|
||||
┌─────────┬───────┬───────┬───────┬───────┬──────────┬──────────┬────────┐
|
||||
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
|
||||
├─────────┼───────┼───────┼───────┼───────┼──────────┼──────────┼────────┤
|
||||
│ Latency │ 61 ms │ 64 ms │ 71 ms │ 94 ms │ 65.44 ms │ 17.35 ms │ 325 ms │
|
||||
└─────────┴───────┴───────┴───────┴───────┴──────────┴──────────┴────────┘
|
||||
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬────────┬─────────┐
|
||||
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────┼─────────┤
|
||||
│ Req/Sec │ 14183 │ 14183 │ 15767 │ 15991 │ 15640 │ 501.13 │ 14182 │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────┼─────────┤
|
||||
│ Bytes/Sec │ 3.06 MB │ 3.06 MB │ 3.41 MB │ 3.45 MB │ 3.38 MB │ 108 kB │ 3.06 MB │
|
||||
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴────────┴─────────┘
|
||||
|
||||
Req/Bytes counts sampled once per second.
|
||||
|
||||
156k requests in 10.24s, 33.8 MB read
|
||||
-----------------------
|
||||
fastify
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
1024 connections
|
||||
|
||||
┌─────────┬───────┬───────┬───────┬───────┬──────────┬──────────┬─────────┐
|
||||
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
|
||||
├─────────┼───────┼───────┼───────┼───────┼──────────┼──────────┼─────────┤
|
||||
│ Latency │ 27 ms │ 30 ms │ 39 ms │ 78 ms │ 31.62 ms │ 26.59 ms │ 1232 ms │
|
||||
└─────────┴───────┴───────┴───────┴───────┴──────────┴──────────┴─────────┘
|
||||
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
|
||||
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
|
||||
│ Req/Sec │ 19935 │ 19935 │ 33247 │ 34111 │ 32030.4 │ 4103.84 │ 19931 │
|
||||
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
|
||||
│ Bytes/Sec │ 3.03 MB │ 3.03 MB │ 5.05 MB │ 5.19 MB │ 4.87 MB │ 624 kB │ 3.03 MB │
|
||||
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘
|
||||
|
||||
Req/Bytes counts sampled once per second.
|
||||
|
||||
320k requests in 10.18s, 48.7 MB read
|
||||
-----------------------
|
||||
nest (with "@nestjs/platform-fastify")
|
||||
-----------------------
|
||||
Running 10s test @ http://localhost:3000
|
||||
1024 connections
|
||||
|
||||
┌─────────┬───────┬───────┬───────┬───────┬──────────┬──────────┬────────┐
|
||||
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
|
||||
├─────────┼───────┼───────┼───────┼───────┼──────────┼──────────┼────────┤
|
||||
│ Latency │ 31 ms │ 33 ms │ 38 ms │ 52 ms │ 34.41 ms │ 11.73 ms │ 245 ms │
|
||||
└─────────┴───────┴───────┴───────┴───────┴──────────┴──────────┴────────┘
|
||||
┌───────────┬─────────┬─────────┬────────┬─────────┬─────────┬─────────┬─────────┐
|
||||
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
|
||||
├───────────┼─────────┼─────────┼────────┼─────────┼─────────┼─────────┼─────────┤
|
||||
│ Req/Sec │ 24911 │ 24911 │ 30031 │ 30335 │ 29470.4 │ 1564.48 │ 24907 │
|
||||
├───────────┼─────────┼─────────┼────────┼─────────┼─────────┼─────────┼─────────┤
|
||||
│ Bytes/Sec │ 3.81 MB │ 3.81 MB │ 4.6 MB │ 4.64 MB │ 4.51 MB │ 239 kB │ 3.81 MB │
|
||||
└───────────┴─────────┴─────────┴────────┴─────────┴─────────┴─────────┴─────────┘
|
||||
|
||||
Req/Bytes counts sampled once per second.
|
||||
|
||||
295k requests in 10.17s, 45.1 MB read
|
||||
@@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
app.get('/', async (req, res) => res.send('Hello world'));
|
||||
app.listen(3000);
|
||||
@@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fastify = require('fastify')();
|
||||
fastify.get('/', async (req, reply) => reply.send('Hello world'));
|
||||
fastify.listen({
|
||||
port: 3000
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const core_1 = require('@nestjs/core');
|
||||
const fastify_platform_1 = require('@nestjs/platform-fastify');
|
||||
const app_module_1 = require('./nest/app.module');
|
||||
core_1.NestFactory.create(
|
||||
app_module_1.AppModule,
|
||||
new fastify_platform_1.FastifyAdapter(),
|
||||
{
|
||||
logger: false,
|
||||
bodyParser: false,
|
||||
},
|
||||
).then(app => app.listen(3000));
|
||||
//# sourceMappingURL=main.js.map
|
||||
@@ -1,9 +0,0 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const core_1 = require('@nestjs/core');
|
||||
const app_module_1 = require('./nest/app.module');
|
||||
core_1.NestFactory.create(app_module_1.AppModule, {
|
||||
logger: false,
|
||||
bodyParser: false,
|
||||
}).then(app => app.listen(3000));
|
||||
//# sourceMappingURL=main.js.map
|
||||
3
benchmarks/nest/app.controller.d.ts
vendored
3
benchmarks/nest/app.controller.d.ts
vendored
@@ -1,3 +0,0 @@
|
||||
export declare class AppController {
|
||||
root(): string;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
'use strict';
|
||||
var __decorate =
|
||||
(this && this.__decorate) ||
|
||||
function(decorators, target, key, desc) {
|
||||
var c = arguments.length,
|
||||
r =
|
||||
c < 3
|
||||
? target
|
||||
: desc === null
|
||||
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
||||
: desc,
|
||||
d;
|
||||
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
||||
r = Reflect.decorate(decorators, target, key, desc);
|
||||
else
|
||||
for (var i = decorators.length - 1; i >= 0; i--)
|
||||
if ((d = decorators[i]))
|
||||
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata =
|
||||
(this && this.__metadata) ||
|
||||
function(k, v) {
|
||||
if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function')
|
||||
return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const common_1 = require('@nestjs/common');
|
||||
let AppController = class AppController {
|
||||
root() {
|
||||
return 'Hello world!';
|
||||
}
|
||||
};
|
||||
__decorate(
|
||||
[
|
||||
common_1.Get(),
|
||||
__metadata('design:type', Function),
|
||||
__metadata('design:paramtypes', []),
|
||||
__metadata('design:returntype', String),
|
||||
],
|
||||
AppController.prototype,
|
||||
'root',
|
||||
null,
|
||||
);
|
||||
AppController = __decorate([common_1.Controller()], AppController);
|
||||
exports.AppController = AppController;
|
||||
//# sourceMappingURL=app.controller.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAiD;AAGjD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAExB,IAAI;QACF,OAAO,cAAc,CAAA;IACvB,CAAC;CACF,CAAA;AAHC;IADC,YAAG,EAAE;;;;yCAGL;AAJU,aAAa;IADzB,mBAAU,EAAE;GACA,aAAa,CAKzB;AALY,sCAAa"}
|
||||
1
benchmarks/nest/app.module.d.ts
vendored
1
benchmarks/nest/app.module.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export declare class AppModule {}
|
||||
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const common_1 = require("@nestjs/common");
|
||||
const app_controller_1 = require("./app.controller");
|
||||
let AppModule = class AppModule {
|
||||
};
|
||||
AppModule = __decorate([
|
||||
common_1.Module({
|
||||
imports: [],
|
||||
controllers: [app_controller_1.AppController],
|
||||
})
|
||||
], AppModule);
|
||||
exports.AppModule = AppModule;
|
||||
//# sourceMappingURL=app.module.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAMjD,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAJrB,eAAM,CAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;KAC7B,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}
|
||||
1
benchmarks/nest/main.d.ts
vendored
1
benchmarks/nest/main.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}
|
||||
22
bundle/common/LICENSE
Normal file
22
bundle/common/LICENSE
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2017 Kamil Myśliwiec <http://kamilmysliwiec.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
111
bundle/common/Readme.md
Normal file
111
bundle/common/Readme.md
Normal file
@@ -0,0 +1,111 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a> and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a> which improve developer productivity and enable the construction of fast, testable, extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers and tools for Node, none of them effectively solve the main problem - the architecture.</p>
|
||||
<p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, loosely coupled and easily maintainable applications.</p>
|
||||
|
||||
## Getting started
|
||||
|
||||
To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="150" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/30/website" target="_blank"><img src="https://opencollective.com/nest/backer/30/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/31/website" target="_blank"><img src="https://opencollective.com/nest/backer/31/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/32/website" target="_blank"><img src="https://opencollective.com/nest/backer/32/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/33/website" target="_blank"><img src="https://opencollective.com/nest/backer/33/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/34/website" target="_blank"><img src="https://opencollective.com/nest/backer/34/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/35/website" target="_blank"><img src="https://opencollective.com/nest/backer/35/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/36/website" target="_blank"><img src="https://opencollective.com/nest/backer/36/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/37/website" target="_blank"><img src="https://opencollective.com/nest/backer/37/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/38/website" target="_blank"><img src="https://opencollective.com/nest/backer/38/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/39/website" target="_blank"><img src="https://opencollective.com/nest/backer/39/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/40/website" target="_blank"><img src="https://opencollective.com/nest/backer/40/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/41/website" target="_blank"><img src="https://opencollective.com/nest/backer/41/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/42/website" target="_blank"><img src="https://opencollective.com/nest/backer/42/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/43/website" target="_blank"><img src="https://opencollective.com/nest/backer/43/avatar.svg"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
27
bundle/common/constants.d.ts
vendored
Normal file
27
bundle/common/constants.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export declare const metadata: {
|
||||
MODULES: string;
|
||||
IMPORTS: string;
|
||||
COMPONENTS: string;
|
||||
PROVIDERS: string;
|
||||
CONTROLLERS: string;
|
||||
EXPORTS: string;
|
||||
};
|
||||
export declare const SHARED_MODULE_METADATA = "__sharedModule__";
|
||||
export declare const GLOBAL_MODULE_METADATA = "__globalModule__";
|
||||
export declare const PATH_METADATA = "path";
|
||||
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
||||
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
||||
export declare const METHOD_METADATA = "method";
|
||||
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
||||
export declare const CUSTOM_ROUTE_AGRS_METADATA = "__customRouteArgs__";
|
||||
export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
||||
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
||||
export declare const PIPES_METADATA = "__pipes__";
|
||||
export declare const GUARDS_METADATA = "__guards__";
|
||||
export declare const RENDER_METADATA = "__renderTemplate__";
|
||||
export declare const INTERCEPTORS_METADATA = "__interceptors__";
|
||||
export declare const HTTP_CODE_METADATA = "__httpCode__";
|
||||
export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddleware";
|
||||
export declare const MODULE_PATH = "__module_path__";
|
||||
export declare const HEADERS_METADATA = "__headers__";
|
||||
export declare const REDIRECT_METADATA = "__redirect__";
|
||||
29
bundle/common/constants.js
Normal file
29
bundle/common/constants.js
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.metadata = {
|
||||
MODULES: 'modules',
|
||||
IMPORTS: 'imports',
|
||||
COMPONENTS: 'components',
|
||||
PROVIDERS: 'providers',
|
||||
CONTROLLERS: 'controllers',
|
||||
EXPORTS: 'exports',
|
||||
};
|
||||
exports.SHARED_MODULE_METADATA = '__sharedModule__';
|
||||
exports.GLOBAL_MODULE_METADATA = '__globalModule__';
|
||||
exports.PATH_METADATA = 'path';
|
||||
exports.PARAMTYPES_METADATA = 'design:paramtypes';
|
||||
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
|
||||
exports.METHOD_METADATA = 'method';
|
||||
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
|
||||
exports.CUSTOM_ROUTE_AGRS_METADATA = '__customRouteArgs__';
|
||||
exports.EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
|
||||
exports.FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
|
||||
exports.PIPES_METADATA = '__pipes__';
|
||||
exports.GUARDS_METADATA = '__guards__';
|
||||
exports.RENDER_METADATA = '__renderTemplate__';
|
||||
exports.INTERCEPTORS_METADATA = '__interceptors__';
|
||||
exports.HTTP_CODE_METADATA = '__httpCode__';
|
||||
exports.GATEWAY_MIDDLEWARES = '__gatewayMiddleware';
|
||||
exports.MODULE_PATH = '__module_path__';
|
||||
exports.HEADERS_METADATA = '__headers__';
|
||||
exports.REDIRECT_METADATA = '__redirect__';
|
||||
6
bundle/common/decorators/core/bind.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/bind.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
export declare function Bind(...decorators: any[]): (target: object, key: any, descriptor: any) => any;
|
||||
14
bundle/common/decorators/core/bind.decorator.js
Normal file
14
bundle/common/decorators/core/bind.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
function Bind(...decorators) {
|
||||
return (target, key, descriptor) => {
|
||||
decorators.forEach((fn, index) => fn(target, key, index));
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Bind = Bind;
|
||||
6
bundle/common/decorators/core/catch.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/catch.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
export declare function Catch(...exceptions: any[]): ClassDecorator;
|
||||
14
bundle/common/decorators/core/catch.decorator.js
Normal file
14
bundle/common/decorators/core/catch.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
function Catch(...exceptions) {
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
|
||||
};
|
||||
}
|
||||
exports.Catch = Catch;
|
||||
32
bundle/common/decorators/core/component.decorator.d.ts
vendored
Normal file
32
bundle/common/decorators/core/component.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Injectable(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Component(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
export declare function Pipe(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
export declare function Guard(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
export declare function Middleware(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
export declare function Interceptor(): ClassDecorator;
|
||||
export declare function mixin(mixinClass: any): any;
|
||||
66
bundle/common/decorators/core/component.decorator.js
Normal file
66
bundle/common/decorators/core/component.decorator.js
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Injectable() {
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Component() {
|
||||
deprecate('The @Component() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Component = Component;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
function Pipe() {
|
||||
deprecate('The @Pipe() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Pipe = Pipe;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
function Guard() {
|
||||
deprecate('The @Guard() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Guard = Guard;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
function Middleware() {
|
||||
deprecate('The @Middleware() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Middleware = Middleware;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
function Interceptor() {
|
||||
deprecate('The @Interceptor() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Interceptor = Interceptor;
|
||||
function mixin(mixinClass) {
|
||||
this.offset = this.offset ? ++this.offset : Math.random() * 100;
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: JSON.stringify(this.offset),
|
||||
});
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
6
bundle/common/decorators/core/controller.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/controller.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Controller(prefix?: string): ClassDecorator;
|
||||
16
bundle/common/decorators/core/controller.decorator.js
Normal file
16
bundle/common/decorators/core/controller.decorator.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Controller(prefix) {
|
||||
const path = shared_utils_1.isUndefined(prefix) ? '/' : prefix;
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.PATH_METADATA, path, target);
|
||||
};
|
||||
}
|
||||
exports.Controller = Controller;
|
||||
3
bundle/common/decorators/core/dependencies.decorator.d.ts
vendored
Normal file
3
bundle/common/decorators/core/dependencies.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
15
bundle/common/decorators/core/dependencies.decorator.js
Normal file
15
bundle/common/decorators/core/dependencies.decorator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
function flatten(arr) {
|
||||
const flat = [].concat(...arr);
|
||||
return flat.some(Array.isArray) ? flatten(flat) : flat;
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
exports.Dependencies = (...dependencies) => {
|
||||
const flattenDeps = flatten(dependencies);
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, flattenDeps, target);
|
||||
};
|
||||
};
|
||||
13
bundle/common/decorators/core/exception-filters.decorator.d.ts
vendored
Normal file
13
bundle/common/decorators/core/exception-filters.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'reflect-metadata';
|
||||
import { ExceptionFilter } from '../../index';
|
||||
/**
|
||||
* Setups exception filters to the chosen context.
|
||||
* When the `@UseFilters()` is used on the controller level:
|
||||
* - Exception Filter will be set up to every handler (every method)
|
||||
*
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
export declare const UseFilters: (...filters: (Function | ExceptionFilter<any>)[]) => (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const defineFiltersMetadata = (...filters) => {
|
||||
return (target, key, descriptor) => {
|
||||
const isFilterValid = filter => filter && (shared_utils_1.isFunction(filter) || shared_utils_1.isFunction(filter.catch));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
||||
return target;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Setups exception filters to the chosen context.
|
||||
* When the `@UseFilters()` is used on the controller level:
|
||||
* - Exception Filter will be set up to every handler (every method)
|
||||
*
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
exports.UseFilters = (...filters) => defineFiltersMetadata(...filters);
|
||||
11
bundle/common/decorators/core/index.d.ts
vendored
Normal file
11
bundle/common/decorators/core/index.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export * from './controller.decorator';
|
||||
export * from './component.decorator';
|
||||
export * from './dependencies.decorator';
|
||||
export * from './inject.decorator';
|
||||
export * from './catch.decorator';
|
||||
export * from './exception-filters.decorator';
|
||||
export * from './use-pipes.decorator';
|
||||
export * from './use-guards.decorator';
|
||||
export * from './reflect-metadata.decorator';
|
||||
export * from './use-interceptors.decorator';
|
||||
export * from './bind.decorator';
|
||||
16
bundle/common/decorators/core/index.js
Normal file
16
bundle/common/decorators/core/index.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./controller.decorator"));
|
||||
__export(require("./component.decorator"));
|
||||
__export(require("./dependencies.decorator"));
|
||||
__export(require("./inject.decorator"));
|
||||
__export(require("./catch.decorator"));
|
||||
__export(require("./exception-filters.decorator"));
|
||||
__export(require("./use-pipes.decorator"));
|
||||
__export(require("./use-guards.decorator"));
|
||||
__export(require("./reflect-metadata.decorator"));
|
||||
__export(require("./use-interceptors.decorator"));
|
||||
__export(require("./bind.decorator"));
|
||||
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
export declare function Inject(token: any): ParameterDecorator;
|
||||
18
bundle/common/decorators/core/inject.decorator.js
Normal file
18
bundle/common/decorators/core/inject.decorator.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
function Inject(token) {
|
||||
return (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, target) || [];
|
||||
const type = shared_utils_1.isFunction(token) ? token.name : token;
|
||||
args.push({ index, param: type });
|
||||
Reflect.defineMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, args, target);
|
||||
};
|
||||
}
|
||||
exports.Inject = Inject;
|
||||
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
export declare const ReflectMetadata: (metadataKey: any, metadataValue: any) => (target: object, key?: any, descriptor?: any) => any;
|
||||
14
bundle/common/decorators/core/reflect-metadata.decorator.js
Normal file
14
bundle/common/decorators/core/reflect-metadata.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
exports.ReflectMetadata = (metadataKey, metadataValue) => (target, key, descriptor) => {
|
||||
if (descriptor) {
|
||||
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
Reflect.defineMetadata(metadataKey, metadataValue, target);
|
||||
return target;
|
||||
};
|
||||
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CanActivate } from '../../interfaces';
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
export declare function UseGuards(...guards: (CanActivate | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
function UseGuards(...guards) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidGuard = guard => guard && (shared_utils_1.isFunction(guard) || shared_utils_1.isFunction(guard.canActivate));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseGuards = UseGuards;
|
||||
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NestInterceptor } from '../../interfaces';
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
export declare function UseInterceptors(...interceptors: (NestInterceptor | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
function UseInterceptors(...interceptors) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidInterceptor = interceptor => interceptor &&
|
||||
(shared_utils_1.isFunction(interceptor) || shared_utils_1.isFunction(interceptor.intercept));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseInterceptors = UseInterceptors;
|
||||
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PipeTransform } from '../../interfaces/index';
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
export declare function UsePipes(...pipes: (PipeTransform | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
function UsePipes(...pipes) {
|
||||
return (target, key, descriptor) => {
|
||||
const isPipeValid = pipe => pipe && (shared_utils_1.isFunction(pipe) || shared_utils_1.isFunction(pipe.transform));
|
||||
if (descriptor) {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UsePipes = UsePipes;
|
||||
13
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
13
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
import { PipeTransform } from '../../index';
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
|
||||
index,
|
||||
factory,
|
||||
data,
|
||||
pipes,
|
||||
} }));
|
||||
const randomString = () => Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory) {
|
||||
const paramtype = randomString() + randomString();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, data, ...pipes), target.constructor, key);
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
function createRouteParamDecorator(factory) {
|
||||
deprecate('The "createRouteParamDecorator" function is deprecated and will be removed within next major release. Use "createParamDecorator" instead.');
|
||||
return createParamDecorator(factory);
|
||||
}
|
||||
exports.createRouteParamDecorator = createRouteParamDecorator;
|
||||
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
export declare function Header(name: string, value: string): MethodDecorator;
|
||||
15
bundle/common/decorators/http/header.decorator.js
Normal file
15
bundle/common/decorators/http/header.decorator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
function Header(name, value) {
|
||||
return (target, key, descriptor) => {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Header = Header;
|
||||
7
bundle/common/decorators/http/http-code.decorator.d.ts
vendored
Normal file
7
bundle/common/decorators/http/http-code.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
*/
|
||||
export declare function HttpCode(statusCode: number): MethodDecorator;
|
||||
16
bundle/common/decorators/http/http-code.decorator.js
Normal file
16
bundle/common/decorators/http/http-code.decorator.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
*/
|
||||
function HttpCode(statusCode) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.HTTP_CODE_METADATA, statusCode, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.HttpCode = HttpCode;
|
||||
6
bundle/common/decorators/http/index.d.ts
vendored
Normal file
6
bundle/common/decorators/http/index.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './request-mapping.decorator';
|
||||
export * from './route-params.decorator';
|
||||
export * from './http-code.decorator';
|
||||
export * from './create-route-param-metadata.decorator';
|
||||
export * from './render.decorator';
|
||||
export * from './header.decorator';
|
||||
11
bundle/common/decorators/http/index.js
Normal file
11
bundle/common/decorators/http/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./request-mapping.decorator"));
|
||||
__export(require("./route-params.decorator"));
|
||||
__export(require("./http-code.decorator"));
|
||||
__export(require("./create-route-param-metadata.decorator"));
|
||||
__export(require("./render.decorator"));
|
||||
__export(require("./header.decorator"));
|
||||
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
export declare function Redirect(url: string): MethodDecorator;
|
||||
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
function Redirect(url) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.REDIRECT_METADATA, url, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Redirect = Redirect;
|
||||
5
bundle/common/decorators/http/render.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/render.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
export declare function Render(template: string): MethodDecorator;
|
||||
14
bundle/common/decorators/http/render.decorator.js
Normal file
14
bundle/common/decorators/http/render.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
function Render(template) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Render = Render;
|
||||
35
bundle/common/decorators/http/request-mapping.decorator.d.ts
vendored
Normal file
35
bundle/common/decorators/http/request-mapping.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'reflect-metadata';
|
||||
import { RequestMappingMetadata } from '../../interfaces/request-mapping-metadata.interface';
|
||||
export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
*/
|
||||
export declare const Post: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP GET requests to the specified path.
|
||||
*/
|
||||
export declare const Get: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP DELETE requests to the specified path.
|
||||
*/
|
||||
export declare const Delete: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP PUT requests to the specified path.
|
||||
*/
|
||||
export declare const Put: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP PATCH requests to the specified path.
|
||||
*/
|
||||
export declare const Patch: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP OPTIONS requests to the specified path.
|
||||
*/
|
||||
export declare const Options: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP HEAD requests to the specified path.
|
||||
*/
|
||||
export declare const Head: (path?: string) => MethodDecorator;
|
||||
/**
|
||||
* Routes all HTTP requests to the specified path.
|
||||
*/
|
||||
export declare const All: (path?: string) => MethodDecorator;
|
||||
56
bundle/common/decorators/http/request-mapping.decorator.js
Normal file
56
bundle/common/decorators/http/request-mapping.decorator.js
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const request_method_enum_1 = require("../../enums/request-method.enum");
|
||||
const constants_1 = require("../../constants");
|
||||
const defaultMetadata = {
|
||||
[constants_1.PATH_METADATA]: '/',
|
||||
[constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET,
|
||||
};
|
||||
exports.RequestMapping = (metadata = defaultMetadata) => {
|
||||
const path = metadata[constants_1.PATH_METADATA] || '/';
|
||||
const requestMethod = metadata[constants_1.METHOD_METADATA] || request_method_enum_1.RequestMethod.GET;
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
|
||||
Reflect.defineMetadata(constants_1.METHOD_METADATA, requestMethod, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
};
|
||||
const createMappingDecorator = (method) => (path) => {
|
||||
return exports.RequestMapping({
|
||||
[constants_1.PATH_METADATA]: path,
|
||||
[constants_1.METHOD_METADATA]: method,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
*/
|
||||
exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST);
|
||||
/**
|
||||
* Routes HTTP GET requests to the specified path.
|
||||
*/
|
||||
exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET);
|
||||
/**
|
||||
* Routes HTTP DELETE requests to the specified path.
|
||||
*/
|
||||
exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELETE);
|
||||
/**
|
||||
* Routes HTTP PUT requests to the specified path.
|
||||
*/
|
||||
exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT);
|
||||
/**
|
||||
* Routes HTTP PATCH requests to the specified path.
|
||||
*/
|
||||
exports.Patch = createMappingDecorator(request_method_enum_1.RequestMethod.PATCH);
|
||||
/**
|
||||
* Routes HTTP OPTIONS requests to the specified path.
|
||||
*/
|
||||
exports.Options = createMappingDecorator(request_method_enum_1.RequestMethod.OPTIONS);
|
||||
/**
|
||||
* Routes HTTP HEAD requests to the specified path.
|
||||
*/
|
||||
exports.Head = createMappingDecorator(request_method_enum_1.RequestMethod.HEAD);
|
||||
/**
|
||||
* Routes all HTTP requests to the specified path.
|
||||
*/
|
||||
exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
|
||||
28
bundle/common/decorators/http/route-params.decorator.d.ts
vendored
Normal file
28
bundle/common/decorators/http/route-params.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'reflect-metadata';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
export declare type ParamData = object | string | number;
|
||||
export interface RouteParamsMetadata {
|
||||
[prop: number]: {
|
||||
index: number;
|
||||
data?: ParamData;
|
||||
};
|
||||
}
|
||||
export declare const Request: () => ParameterDecorator;
|
||||
export declare const Response: () => ParameterDecorator;
|
||||
export declare const Next: () => ParameterDecorator;
|
||||
export declare const Session: () => ParameterDecorator;
|
||||
export declare const UploadedFile: () => ParameterDecorator;
|
||||
export declare const UploadedFiles: () => ParameterDecorator;
|
||||
export declare const Headers: (property?: string) => ParameterDecorator;
|
||||
export declare function Query(): any;
|
||||
export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(): any;
|
||||
export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(): any;
|
||||
export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare const Req: () => ParameterDecorator;
|
||||
export declare const Res: () => ParameterDecorator;
|
||||
45
bundle/common/decorators/http/route-params.decorator.js
Normal file
45
bundle/common/decorators/http/route-params.decorator.js
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const route_paramtypes_enum_1 = require("../../enums/route-paramtypes.enum");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const assignMetadata = (args, paramtype, index, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}:${index}`]: {
|
||||
index,
|
||||
data,
|
||||
pipes,
|
||||
} }));
|
||||
const createRouteParamDecorator = (paramtype) => {
|
||||
return (data) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
||||
};
|
||||
};
|
||||
const createPipesRouteParamDecorator = (paramtype) => (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target.constructor, key);
|
||||
};
|
||||
exports.Request = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.REQUEST);
|
||||
exports.Response = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RESPONSE);
|
||||
exports.Next = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.NEXT);
|
||||
exports.Session = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.SESSION);
|
||||
exports.UploadedFile = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILE);
|
||||
exports.UploadedFiles = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILES);
|
||||
exports.Headers = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.HEADERS);
|
||||
function Query(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.QUERY)(property, ...pipes);
|
||||
}
|
||||
exports.Query = Query;
|
||||
function Body(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.BODY)(property, ...pipes);
|
||||
}
|
||||
exports.Body = Body;
|
||||
function Param(property, ...pipes) {
|
||||
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.PARAM)(property, ...pipes);
|
||||
}
|
||||
exports.Param = Param;
|
||||
exports.Req = exports.Request;
|
||||
exports.Res = exports.Response;
|
||||
3
bundle/common/decorators/index.d.ts
vendored
Normal file
3
bundle/common/decorators/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './core';
|
||||
export * from './modules';
|
||||
export * from './http';
|
||||
8
bundle/common/decorators/index.js
Normal file
8
bundle/common/decorators/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./core"));
|
||||
__export(require("./modules"));
|
||||
__export(require("./http"));
|
||||
1
bundle/common/decorators/modules/exceptions/constants.d.ts
vendored
Normal file
1
bundle/common/decorators/modules/exceptions/constants.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const InvalidModuleConfigMessage: (property: string) => string;
|
||||
3
bundle/common/decorators/modules/exceptions/constants.js
Normal file
3
bundle/common/decorators/modules/exceptions/constants.js
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.InvalidModuleConfigMessage = (property) => `Invalid property '${property}' in @Module() decorator.`;
|
||||
3
bundle/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts
vendored
Normal file
3
bundle/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare class InvalidModuleConfigException extends Error {
|
||||
constructor(property: string);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("./constants");
|
||||
class InvalidModuleConfigException extends Error {
|
||||
constructor(property) {
|
||||
super(constants_1.InvalidModuleConfigMessage(property));
|
||||
}
|
||||
}
|
||||
exports.InvalidModuleConfigException = InvalidModuleConfigException;
|
||||
6
bundle/common/decorators/modules/global.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/modules/global.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
export declare function Global(): ClassDecorator;
|
||||
14
bundle/common/decorators/modules/global.decorator.js
Normal file
14
bundle/common/decorators/modules/global.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
function Global() {
|
||||
return (target) => {
|
||||
Reflect.defineMetadata(constants_1.GLOBAL_MODULE_METADATA, true, target);
|
||||
};
|
||||
}
|
||||
exports.Global = Global;
|
||||
3
bundle/common/decorators/modules/index.d.ts
vendored
Normal file
3
bundle/common/decorators/modules/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './module.decorator';
|
||||
export * from './single-scope.decorator';
|
||||
export * from './global.decorator';
|
||||
8
bundle/common/decorators/modules/index.js
Normal file
8
bundle/common/decorators/modules/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./module.decorator"));
|
||||
__export(require("./single-scope.decorator"));
|
||||
__export(require("./global.decorator"));
|
||||
12
bundle/common/decorators/modules/module.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/modules/module.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'reflect-metadata';
|
||||
import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interface';
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
export declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
||||
61
bundle/common/decorators/modules/module.decorator.js
Normal file
61
bundle/common/decorators/modules/module.decorator.js
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const invalid_module_config_exception_1 = require("./exceptions/invalid-module-config.exception");
|
||||
const metadataKeys = [
|
||||
constants_1.metadata.MODULES,
|
||||
constants_1.metadata.IMPORTS,
|
||||
constants_1.metadata.EXPORTS,
|
||||
constants_1.metadata.COMPONENTS,
|
||||
constants_1.metadata.CONTROLLERS,
|
||||
constants_1.metadata.PROVIDERS,
|
||||
];
|
||||
const validateKeys = (keys) => {
|
||||
const isKeyInvalid = key => metadataKeys.findIndex(k => k === key) < 0;
|
||||
const validateKey = key => {
|
||||
if (!isKeyInvalid(key)) {
|
||||
return;
|
||||
}
|
||||
throw new invalid_module_config_exception_1.InvalidModuleConfigException(key);
|
||||
};
|
||||
keys.forEach(validateKey);
|
||||
};
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
function Module(metadata) {
|
||||
const propsKeys = Object.keys(metadata);
|
||||
validateKeys(propsKeys);
|
||||
showDeprecatedWarnings(metadata);
|
||||
overrideModuleMetadata(metadata);
|
||||
return (target) => {
|
||||
for (const property in metadata) {
|
||||
if (metadata.hasOwnProperty(property)) {
|
||||
Reflect.defineMetadata(property, metadata[property], target);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Module = Module;
|
||||
function overrideModuleMetadata(moduleMetadata) {
|
||||
moduleMetadata.modules = moduleMetadata.imports
|
||||
? moduleMetadata.imports
|
||||
: moduleMetadata.modules;
|
||||
moduleMetadata.components = moduleMetadata.providers
|
||||
? moduleMetadata.providers
|
||||
: moduleMetadata.components;
|
||||
}
|
||||
function showDeprecatedWarnings(moduleMetadata) {
|
||||
const modulesDeprecatedWarning = 'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
|
||||
const componentsDeprecatetWarning = 'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
|
||||
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
|
||||
}
|
||||
7
bundle/common/decorators/modules/shared.decorator.d.ts
vendored
Normal file
7
bundle/common/decorators/modules/shared.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Specifies scope of this module. When module is `@Shared()`, Nest will create only one instance of this
|
||||
* module and share them between all of the modules.
|
||||
* @deprecated
|
||||
*/
|
||||
export declare const Shared: (scope?: string) => (target: any) => any;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user