Compare commits

...

147 Commits

Author SHA1 Message Date
Kamil Myśliwiec
1b366ce38f style(): auto-organise import statements 2020-12-08 11:35:04 +01:00
Kamil Myśliwiec
dac16e65c7 Merge branch 'master' of https://github.com/nestjs/nest; branch 'controller-path-alias' of https://github.com/miZyind/nest into miZyind-controller-path-alias 2020-12-08 11:33:57 +01:00
Kamil Mysliwiec
51e6b81bc8 Merge pull request #5681 from xuzaixian/feature/log-timestemp
feat: timestemp inside LoggerSerivce can be overridden
2020-12-08 11:17:04 +01:00
Kamil Mysliwiec
57b1425848 Merge pull request #5851 from nvdnkpr/patch-1
refactor(common): Make LoggerService's instance property and getInstance() method protected to allow sub-classes access to it
2020-12-08 10:55:58 +01:00
Kamil Mysliwiec
b14c78e4f1 Merge pull request #5801 from poulad/master
fix(microservices): handle rmq queue deletion
2020-12-08 10:46:35 +01:00
Kamil Myśliwiec
9ee12da212 Merge branch 'msrumon-app-locals' 2020-12-08 10:44:37 +01:00
Kamil Myśliwiec
2a456eff23 docs(common): add missing dot 2020-12-08 10:44:29 +01:00
Kamil Myśliwiec
c687fe98a4 Merge branch 'app-locals' of https://github.com/msrumon/nest into msrumon-app-locals 2020-12-08 10:44:06 +01:00
Kamil Mysliwiec
46e2339fb2 Merge pull request #5854 from ahiho/iisnode
fix: iisnode uses pipe name instead of port number
2020-12-08 10:42:30 +01:00
Kamil Myśliwiec
41d46c0c07 fix(core): add no-transform to cache-control header (sse) #5762 2020-12-08 10:33:48 +01:00
Kamil Mysliwiec
d97799cd30 Merge pull request #5813 from poulad/issue_5812
feat(microservices): log event name w/o handler
2020-12-08 10:02:10 +01:00
Kamil Mysliwiec
3f16a9c759 Merge pull request #5802 from jmcdo29/fix/get-url-in-callback
fix(application): makes get-url work in callback
2020-12-08 10:01:21 +01:00
Kamil Mysliwiec
a042eee0db Merge pull request #5775 from nestjs/fix/async-dynamic-module-imports-5774
fix(core): await dynamic module imports #5774
2020-12-08 09:58:32 +01:00
Kamil Mysliwiec
fabee8c985 Merge pull request #5860 from getspooky/common-status
feat(packages/common/enums): Add EARLYHINTS status code
2020-12-08 09:57:48 +01:00
Kamil Mysliwiec
dd0126d37e Merge pull request #5878 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.5
chore(deps-dev): bump mongoose from 5.11.4 to 5.11.5
2020-12-08 09:55:13 +01:00
Kamil Mysliwiec
df3fdbd2b2 Merge pull request #5881 from nestjs/dependabot/npm_and_yarn/ts-node-9.1.1
chore(deps-dev): bump ts-node from 9.1.0 to 9.1.1
2020-12-08 09:55:00 +01:00
Kamil Mysliwiec
33e13467b0 Merge pull request #5872 from nestjs/dependabot/npm_and_yarn/eslint-7.15.0
chore(deps-dev): bump eslint from 7.14.0 to 7.15.0
2020-12-08 09:54:45 +01:00
Kamil Mysliwiec
ce48da086d Merge pull request #5877 from nestjs/dependabot/npm_and_yarn/types/socket.io-2.1.12
chore(deps-dev): bump @types/socket.io from 2.1.11 to 2.1.12
2020-12-08 09:54:38 +01:00
Kamil Mysliwiec
3b4b6ba6d4 Merge pull request #5880 from nestjs/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-4.9.1
chore(deps-dev): bump @typescript-eslint/eslint-plugin from 4.9.0 to 4.9.1
2020-12-08 09:54:31 +01:00
Kamil Mysliwiec
a371ce43aa Merge pull request #5882 from nestjs/dependabot/npm_and_yarn/husky-4.3.5
chore(deps-dev): bump husky from 4.3.0 to 4.3.5
2020-12-08 09:54:12 +01:00
dependabot[bot]
e2a2c5de23 chore(deps-dev): bump husky from 4.3.0 to 4.3.5
Bumps [husky](https://github.com/typicode/husky) from 4.3.0 to 4.3.5.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.0...v4.3.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 05:46:00 +00:00
dependabot[bot]
e5447c3211 chore(deps-dev): bump ts-node from 9.1.0 to 9.1.1
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.1.0 to 9.1.1.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v9.1.0...v9.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 05:42:20 +00:00
dependabot[bot]
32be557506 chore(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.9.0 to 4.9.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.9.1/packages/eslint-plugin)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 05:38:55 +00:00
dependabot[bot]
d433cd6869 chore(deps-dev): bump mongoose from 5.11.4 to 5.11.5
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.11.4 to 5.11.5.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.11.4...5.11.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 05:31:15 +00:00
dependabot[bot]
59b9af9ad8 chore(deps-dev): bump @types/socket.io from 2.1.11 to 2.1.12
Bumps [@types/socket.io](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/socket.io) from 2.1.11 to 2.1.12.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/socket.io)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-08 05:27:36 +00:00
dependabot[bot]
92e477950f chore(deps-dev): bump eslint from 7.14.0 to 7.15.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.14.0 to 7.15.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.14.0...v7.15.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 08:35:04 +00:00
Kamil Mysliwiec
3333676e8a Merge pull request #5869 from nestjs/dependabot/npm_and_yarn/core-js-3.8.1
chore(deps-dev): bump core-js from 3.8.0 to 3.8.1
2020-12-07 09:22:43 +01:00
Kamil Mysliwiec
51917ce535 Merge pull request #5871 from nestjs/dependabot/npm_and_yarn/lint-staged-10.5.3
chore(deps-dev): bump lint-staged from 10.5.2 to 10.5.3
2020-12-07 09:22:34 +01:00
Kamil Mysliwiec
d8be7989fd Merge pull request #5873 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.4
chore(deps-dev): bump mongoose from 5.11.3 to 5.11.4
2020-12-07 09:22:13 +01:00
Kamil Mysliwiec
a0d0d8965e Merge pull request #5874 from nestjs/dependabot/npm_and_yarn/eslint-config-prettier-7.0.0
chore(deps-dev): bump eslint-config-prettier from 6.15.0 to 7.0.0
2020-12-07 09:22:00 +01:00
Kamil Mysliwiec
00fc0564ab Merge pull request #5870 from nestjs/dependabot/npm_and_yarn/ws-7.4.1
chore(deps): bump ws from 7.4.0 to 7.4.1
2020-12-07 09:21:39 +01:00
dependabot[bot]
fc9bc68ff4 chore(deps-dev): bump eslint-config-prettier from 6.15.0 to 7.0.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.15.0 to 7.0.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.15.0...v7.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 05:52:48 +00:00
dependabot[bot]
2be97be12d chore(deps-dev): bump mongoose from 5.11.3 to 5.11.4
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.11.3 to 5.11.4.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.11.3...5.11.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 05:50:55 +00:00
dependabot[bot]
873bd374bc chore(deps-dev): bump lint-staged from 10.5.2 to 10.5.3
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.2 to 10.5.3.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.2...v10.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 05:46:59 +00:00
dependabot[bot]
0cee898087 chore(deps): bump ws from 7.4.0 to 7.4.1
Bumps [ws](https://github.com/websockets/ws) from 7.4.0 to 7.4.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.0...7.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 05:44:39 +00:00
dependabot[bot]
e04803e9fa chore(deps-dev): bump core-js from 3.8.0 to 3.8.1
Bumps [core-js](https://github.com/zloirock/core-js) from 3.8.0 to 3.8.1.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zloirock/core-js/compare/v3.8.0...v3.8.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-07 05:42:38 +00:00
Kamil Mysliwiec
3044e1555f Merge pull request #5856 from nestjs/dependabot/npm_and_yarn/types/mongoose-5.10.2
chore(deps-dev): bump @types/mongoose from 5.10.1 to 5.10.2
2020-12-04 09:19:39 +01:00
Kamil Mysliwiec
7c806d6e4d Merge pull request #5857 from nestjs/dependabot/npm_and_yarn/ts-node-9.1.0
chore(deps-dev): bump ts-node from 9.0.0 to 9.1.0
2020-12-04 09:19:26 +01:00
Kamil Mysliwiec
b6d6d2fc3f Merge pull request #5858 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.3
chore(deps-dev): bump mongoose from 5.11.2 to 5.11.3
2020-12-04 09:19:08 +01:00
yasser
ed0588d707 feat(packages/common/enums): Add EARLYHINTS status code 2020-12-04 09:18:49 +01:00
dependabot[bot]
9b3c628a05 chore(deps-dev): bump mongoose from 5.11.2 to 5.11.3
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.11.2 to 5.11.3.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.11.2...5.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-04 05:31:44 +00:00
dependabot[bot]
7636b04f2f chore(deps-dev): bump ts-node from 9.0.0 to 9.1.0
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.0.0 to 9.1.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v9.0.0...v9.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-04 05:29:38 +00:00
dependabot[bot]
62eb22e507 chore(deps-dev): bump @types/mongoose from 5.10.1 to 5.10.2
Bumps [@types/mongoose](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mongoose) from 5.10.1 to 5.10.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mongoose)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-04 05:27:16 +00:00
Thanh Vu
4fd7e16444 fix: iisnode uses pipe name instead of port number 2020-12-04 01:56:16 +07:00
Navid Nikpour
ee53291960 Update logger.service.ts
Change private static `instance` property to protected to be able to access it from sub-classes
2020-12-03 10:40:39 +01:00
Navid Nikpour
5a1c58eaf1 Update logger.service.ts
Make getInstance() protected so derived classes get access to the overriden logger instance
2020-12-03 10:31:05 +01:00
Kamil Mysliwiec
0618737c69 Merge pull request #5850 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.2
chore(deps-dev): bump mongoose from 5.11.1 to 5.11.2
2020-12-03 09:15:27 +01:00
Kamil Mysliwiec
b5bcc04298 Merge pull request #5849 from nestjs/dependabot/npm_and_yarn/fastify-3.9.1
chore(deps): bump fastify from 3.8.0 to 3.9.1
2020-12-03 09:14:18 +01:00
dependabot[bot]
eb7cd4757f chore(deps-dev): bump mongoose from 5.11.1 to 5.11.2
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.11.1 to 5.11.2.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.11.1...5.11.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-03 05:30:43 +00:00
dependabot[bot]
e6fb4fe526 chore(deps): bump fastify from 3.8.0 to 3.9.1
Bumps [fastify](https://github.com/fastify/fastify) from 3.8.0 to 3.9.1.
- [Release notes](https://github.com/fastify/fastify/releases)
- [Commits](https://github.com/fastify/fastify/compare/v3.8.0...v3.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-03 05:26:44 +00:00
Kamil Mysliwiec
d47e811246 Merge pull request #5846 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.1
chore(deps-dev): bump mongoose from 5.11.0 to 5.11.1
2020-12-02 08:18:41 +01:00
dependabot[bot]
6012b0180a chore(deps-dev): bump mongoose from 5.11.0 to 5.11.1
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.11.0 to 5.11.1.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.11.0...5.11.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-02 05:28:54 +00:00
Kamil Mysliwiec
95292d72c8 Merge pull request #5843 from Tony133/docs/update-sample-contribute
docs(contribuiting):update sample for fix
2020-12-01 11:15:34 +01:00
Tony133
fa953c2693 docs(contribuiting):update sample for fix 2020-12-01 11:10:59 +01:00
Kamil Mysliwiec
2f5e402614 Merge pull request #5837 from nestjs/dependabot/npm_and_yarn/typescript-eslint/parser-4.9.0
chore(deps-dev): bump @typescript-eslint/parser from 4.8.2 to 4.9.0
2020-12-01 11:05:14 +01:00
dependabot[bot]
b218d93856 chore(deps-dev): bump @typescript-eslint/parser from 4.8.2 to 4.9.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.8.2 to 4.9.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.9.0/packages/parser)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 07:34:30 +00:00
Kamil Mysliwiec
134ffce1c9 Merge pull request #5838 from nestjs/dependabot/npm_and_yarn/nestjs/graphql-7.9.1
chore(deps-dev): bump @nestjs/graphql from 7.9.0 to 7.9.1
2020-12-01 08:32:32 +01:00
Kamil Mysliwiec
f9ce94941c Merge pull request #5839 from nestjs/dependabot/npm_and_yarn/fastify-multipart-3.3.1
chore(deps-dev): bump fastify-multipart from 3.3.0 to 3.3.1
2020-12-01 08:32:24 +01:00
Kamil Mysliwiec
4e5c128a18 Merge pull request #5840 from nestjs/dependabot/npm_and_yarn/mongoose-5.11.0
chore(deps-dev): bump mongoose from 5.10.18 to 5.11.0
2020-12-01 08:32:17 +01:00
Kamil Mysliwiec
b98fbd6272 Merge pull request #5841 from nestjs/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-4.9.0
chore(deps-dev): bump @typescript-eslint/eslint-plugin from 4.8.2 to 4.9.0
2020-12-01 08:32:10 +01:00
dependabot[bot]
7ee8b71add chore(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.8.2 to 4.9.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.9.0/packages/eslint-plugin)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:48:13 +00:00
dependabot[bot]
3e44af2842 chore(deps-dev): bump mongoose from 5.10.18 to 5.11.0
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.10.18 to 5.11.0.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.10.18...5.11.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:45:51 +00:00
dependabot[bot]
1bbba82333 chore(deps-dev): bump fastify-multipart from 3.3.0 to 3.3.1
Bumps [fastify-multipart](https://github.com/fastify/fastify-multipart) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/fastify/fastify-multipart/releases)
- [Commits](https://github.com/fastify/fastify-multipart/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:43:44 +00:00
dependabot[bot]
7875091c86 chore(deps-dev): bump @nestjs/graphql from 7.9.0 to 7.9.1
Bumps [@nestjs/graphql](https://github.com/nestjs/graphql) from 7.9.0 to 7.9.1.
- [Release notes](https://github.com/nestjs/graphql/releases)
- [Changelog](https://github.com/nestjs/graphql/blob/master/.release-it.json)
- [Commits](https://github.com/nestjs/graphql/compare/7.9.0...7.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 05:41:24 +00:00
Rumon
3d33283e6b feat(core): expose app.locals to express adapter 2020-11-30 23:33:15 +06:00
Kamil Mysliwiec
c69c24e63c Merge pull request #5823 from nestjs/dependabot/npm_and_yarn/prettier-2.2.1
chore(deps-dev): bump prettier from 2.2.0 to 2.2.1
2020-11-30 12:06:35 +01:00
miZyind
bead1f4a57 feat(core): add support to controller path alias and refactor shard util 2020-11-30 18:00:15 +07:00
dependabot[bot]
3e616f9e84 chore(deps-dev): bump prettier from 2.2.0 to 2.2.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.2.0...2.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 08:12:36 +00:00
Kamil Mysliwiec
f90af4911d Merge pull request #5819 from kaznovac/jsdoc-fixes
refactor: jsdoc fixes for INestApplication, INestMicroservice, MiddlewareConsumer and MiddlewareConfigProxy
2020-11-30 08:52:44 +01:00
Kamil Mysliwiec
3a97eecb60 Merge pull request #5820 from kaznovac/microservice-listen-void
fix(microservices): listen method is void return type
2020-11-30 08:46:26 +01:00
Kamil Mysliwiec
48690903d2 Update packages/microservices/nest-microservice.ts 2020-11-30 08:46:16 +01:00
Kamil Mysliwiec
50fe8c7285 Merge pull request #5803 from nestjs/dependabot/npm_and_yarn/types/mongoose-5.10.1
chore(deps-dev): bump @types/mongoose from 5.7.36 to 5.10.1
2020-11-30 08:41:33 +01:00
Kamil Mysliwiec
f22283d9b2 Merge pull request #5824 from nestjs/dependabot/npm_and_yarn/mongoose-5.10.18
chore(deps-dev): bump mongoose from 5.10.16 to 5.10.18
2020-11-30 08:41:23 +01:00
Kamil Mysliwiec
6d108aee4f Merge pull request #5825 from nestjs/dependabot/npm_and_yarn/point-of-view-4.7.0
chore(deps-dev): bump point-of-view from 4.6.0 to 4.7.0
2020-11-30 08:41:17 +01:00
Kamil Mysliwiec
e8db6d3ddd Merge pull request #5826 from nestjs/dependabot/npm_and_yarn/ts-morph-9.1.0
chore(deps-dev): bump ts-morph from 9.0.0 to 9.1.0
2020-11-30 08:41:11 +01:00
Kamil Mysliwiec
2c1dc05966 Merge pull request #5827 from nestjs/dependabot/npm_and_yarn/nestjs/graphql-7.9.0
chore(deps-dev): bump @nestjs/graphql from 7.8.2 to 7.9.0
2020-11-30 08:41:00 +01:00
dependabot[bot]
087dffff53 chore(deps-dev): bump @nestjs/graphql from 7.8.2 to 7.9.0
Bumps [@nestjs/graphql](https://github.com/nestjs/graphql) from 7.8.2 to 7.9.0.
- [Release notes](https://github.com/nestjs/graphql/releases)
- [Changelog](https://github.com/nestjs/graphql/blob/master/.release-it.json)
- [Commits](https://github.com/nestjs/graphql/compare/7.8.2...7.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 05:45:42 +00:00
dependabot[bot]
ab40602f55 chore(deps-dev): bump ts-morph from 9.0.0 to 9.1.0
Bumps [ts-morph](https://github.com/dsherret/ts-morph) from 9.0.0 to 9.1.0.
- [Release notes](https://github.com/dsherret/ts-morph/releases)
- [Commits](https://github.com/dsherret/ts-morph/compare/9.0.0...9.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 05:42:10 +00:00
dependabot[bot]
41db26a2cf chore(deps-dev): bump point-of-view from 4.6.0 to 4.7.0
Bumps [point-of-view](https://github.com/fastify/point-of-view) from 4.6.0 to 4.7.0.
- [Release notes](https://github.com/fastify/point-of-view/releases)
- [Commits](https://github.com/fastify/point-of-view/compare/v4.6.0...v4.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 05:40:24 +00:00
dependabot[bot]
33a9e23a1f chore(deps-dev): bump mongoose from 5.10.16 to 5.10.18
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.10.16 to 5.10.18.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.10.16...5.10.18)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-30 05:37:02 +00:00
Marko Kaznovac
5bb0cdb583 fix(microservices): listen method is void return type 2020-11-29 00:23:34 +01:00
Marko Kaznovac
c734974484 refactor: jsdoc fixes for INestApplication, INestMicroservice, MiddlewareConsumer and MiddlewareConfigProxy 2020-11-29 00:17:04 +01:00
Poulad Ashrafpour
514101187e Update packages/microservices/server/server.ts
Co-authored-by: Jay McDoniel <jmcdo29@gmail.com>
2020-11-28 07:44:14 -05:00
Kamil Mysliwiec
5aeb40bdc7 Merge pull request #5814 from poulad/update-contrib
docs(core): edit contribution guide
2020-11-28 12:17:31 +01:00
Poulad
d5ad6f3cfc docs(core): edit contribution guide 2020-11-27 20:09:22 -05:00
Poulad
3651f3e1b3 feat(microservices): log event name w/o handler
A descriptive error message tells user exactly what event pattern is missing a handler.
2020-11-27 19:56:46 -05:00
dependabot[bot]
8e72722037 chore(deps-dev): bump @types/mongoose from 5.7.36 to 5.10.1
Bumps [@types/mongoose](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mongoose) from 5.7.36 to 5.10.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mongoose)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-27 09:18:36 +00:00
Kamil Mysliwiec
543432cce9 Merge pull request #5793 from nestjs/dependabot/npm_and_yarn/mongoose-5.10.16
chore(deps-dev): bump mongoose from 5.10.15 to 5.10.16
2020-11-27 10:15:10 +01:00
Kamil Mysliwiec
730f3c684e Merge pull request #5804 from nestjs/dependabot/npm_and_yarn/types/ws-7.4.0
chore(deps-dev): bump @types/ws from 7.2.9 to 7.4.0
2020-11-27 10:14:48 +01:00
Kamil Mysliwiec
68225e5db7 Merge pull request #5805 from nestjs/dependabot/npm_and_yarn/types/node-14.14.10
chore(deps-dev): bump @types/node from 14.14.9 to 14.14.10
2020-11-27 10:14:42 +01:00
Kamil Mysliwiec
4f6d6a6b74 Merge pull request #5806 from nestjs/dependabot/npm_and_yarn/core-js-3.8.0
chore(deps-dev): bump core-js from 3.7.0 to 3.8.0
2020-11-27 10:14:35 +01:00
Kamil Mysliwiec
afaf81d659 Merge pull request #5807 from nestjs/dependabot/npm_and_yarn/graphql-tools-7.0.2
chore(deps-dev): bump graphql-tools from 7.0.1 to 7.0.2
2020-11-27 10:14:27 +01:00
dependabot[bot]
cbc15b843e chore(deps-dev): bump graphql-tools from 7.0.1 to 7.0.2
Bumps [graphql-tools](https://github.com/ardatan/graphql-tools) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/ardatan/graphql-tools/releases)
- [Commits](https://github.com/ardatan/graphql-tools/compare/graphql-tools@7.0.1...graphql-tools@7.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-27 05:34:11 +00:00
dependabot[bot]
9b30109f18 chore(deps-dev): bump core-js from 3.7.0 to 3.8.0
Bumps [core-js](https://github.com/zloirock/core-js) from 3.7.0 to 3.8.0.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zloirock/core-js/compare/v3.7.0...v3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-27 05:32:24 +00:00
dependabot[bot]
fabfa3b7c2 chore(deps-dev): bump @types/node from 14.14.9 to 14.14.10
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.9 to 14.14.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-27 05:30:20 +00:00
dependabot[bot]
7df03aab45 chore(deps-dev): bump @types/ws from 7.2.9 to 7.4.0
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.2.9 to 7.4.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-27 05:28:01 +00:00
Jay McDoniel
f36cb0c729 fix(application): makes get-url work in callback
`app.getUrl()` was throwing an error when `this.isListening`
was set to false. The value was set _after_ `this.httpServer.listen`
was called, now it is set _before_ to ensure that the `app.getUrl()`
can be called in the callback of `listen`. A regression test has
been added for this, and all tests related to the change are passing.

fix: #5798
2020-11-26 14:18:39 -08:00
Poulad
34d1c45d9a fix(microservices): handle rmq queue deletion
A null message is passed to callback when RabbitMQ queue is deleted. See #5683
2020-11-26 17:00:27 -05:00
dependabot[bot]
be6adb406c chore(deps-dev): bump mongoose from 5.10.15 to 5.10.16
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.10.15 to 5.10.16.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md)
- [Commits](https://github.com/Automattic/mongoose/compare/5.10.15...5.10.16)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 13:38:29 +00:00
Kamil Mysliwiec
7c070f3bf3 Merge pull request #5791 from nestjs/dependabot/npm_and_yarn/types/sinon-9.0.9
chore(deps-dev): bump @types/sinon from 9.0.8 to 9.0.9
2020-11-26 14:34:51 +01:00
Kamil Mysliwiec
49bf3529f8 Merge pull request #5792 from nestjs/dependabot/npm_and_yarn/nestjs/typeorm-7.1.5
chore(deps-dev): bump @nestjs/typeorm from 7.1.4 to 7.1.5
2020-11-26 14:34:34 +01:00
Kamil Mysliwiec
fbacade010 Merge pull request #5795 from nestjs/dependabot/npm_and_yarn/types/express-4.17.9
chore(deps-dev): bump @types/express from 4.17.8 to 4.17.9
2020-11-26 14:34:22 +01:00
Kamil Mysliwiec
23616f92e5 Merge pull request #5796 from nestjs/dependabot/npm_and_yarn/mqtt-4.2.6
chore(deps-dev): bump mqtt from 4.2.1 to 4.2.6
2020-11-26 14:34:15 +01:00
Kamil Mysliwiec
57d7412f7d Merge pull request #5799 from yangfan44777/patch-1
style: typo
2020-11-26 14:30:06 +01:00
yangfan44777
02dc0d2951 Update instance-wrapper.spec.ts 2020-11-26 18:56:24 +08:00
dependabot[bot]
6864364fb7 chore(deps-dev): bump mqtt from 4.2.1 to 4.2.6
Bumps [mqtt](https://github.com/mqttjs/MQTT.js) from 4.2.1 to 4.2.6.
- [Release notes](https://github.com/mqttjs/MQTT.js/releases)
- [Commits](https://github.com/mqttjs/MQTT.js/compare/v4.2.1...v4.2.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 05:58:08 +00:00
dependabot[bot]
36f081c693 chore(deps-dev): bump @types/express from 4.17.8 to 4.17.9
Bumps [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express) from 4.17.8 to 4.17.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 05:43:40 +00:00
dependabot[bot]
3184b21a79 chore(deps-dev): bump @nestjs/typeorm from 7.1.4 to 7.1.5
Bumps [@nestjs/typeorm](https://github.com/nestjs/typeorm) from 7.1.4 to 7.1.5.
- [Release notes](https://github.com/nestjs/typeorm/releases)
- [Changelog](https://github.com/nestjs/typeorm/blob/master/.release-it.json)
- [Commits](https://github.com/nestjs/typeorm/compare/7.1.4...7.1.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 05:34:55 +00:00
dependabot[bot]
41693874a1 chore(deps-dev): bump @types/sinon from 9.0.8 to 9.0.9
Bumps [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) from 9.0.8 to 9.0.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-26 05:31:20 +00:00
Kamil Mysliwiec
0c12373320 Merge pull request #5779 from nestjs/renovate/babel-monorepo
chore(deps): update dependency @babel/core to v7.12.9
2020-11-25 09:02:46 +01:00
Kamil Mysliwiec
a0f68acbb3 Merge pull request #5781 from nestjs/dependabot/npm_and_yarn/gulp-sourcemaps-3.0.0
chore(deps-dev): bump gulp-sourcemaps from 2.6.5 to 3.0.0
2020-11-25 09:02:28 +01:00
Kamil Mysliwiec
baa413b2e5 Merge pull request #5782 from nestjs/dependabot/npm_and_yarn/light-my-request-4.3.0
chore(deps): bump light-my-request from 4.2.1 to 4.3.0
2020-11-25 09:01:56 +01:00
Kamil Mysliwiec
44c2dc1c36 Merge pull request #5783 from nestjs/dependabot/npm_and_yarn/nestjs/mongoose-7.1.2
chore(deps-dev): bump @nestjs/mongoose from 7.0.2 to 7.1.2
2020-11-25 09:01:34 +01:00
Kamil Mysliwiec
106ef742dd Merge pull request #5784 from nestjs/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-4.8.2
chore(deps-dev): bump @typescript-eslint/eslint-plugin from 4.5.0 to 4.8.2
2020-11-25 09:01:27 +01:00
Kamil Mysliwiec
72920a39a9 Merge pull request #5785 from nestjs/dependabot/npm_and_yarn/fastify-static-3.3.0
chore(deps-dev): bump fastify-static from 3.2.1 to 3.3.0
2020-11-25 09:01:19 +01:00
dependabot[bot]
fa4ffb7022 chore(deps-dev): bump fastify-static from 3.2.1 to 3.3.0
Bumps [fastify-static](https://github.com/fastify/fastify-static) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/fastify/fastify-static/releases)
- [Commits](https://github.com/fastify/fastify-static/compare/v3.2.1...v3.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 05:23:38 +00:00
dependabot[bot]
d5c39ce1fc chore(deps-dev): bump @typescript-eslint/eslint-plugin
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.5.0 to 4.8.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.8.2/packages/eslint-plugin)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 05:20:55 +00:00
dependabot[bot]
2108a01898 chore(deps-dev): bump @nestjs/mongoose from 7.0.2 to 7.1.2
Bumps [@nestjs/mongoose](https://github.com/nestjs/mongoose) from 7.0.2 to 7.1.2.
- [Release notes](https://github.com/nestjs/mongoose/releases)
- [Changelog](https://github.com/nestjs/mongoose/blob/master/.release-it.json)
- [Commits](https://github.com/nestjs/mongoose/compare/7.0.2...7.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 05:16:47 +00:00
dependabot[bot]
eccefad9ba chore(deps): bump light-my-request from 4.2.1 to 4.3.0
Bumps [light-my-request](https://github.com/fastify/light-my-request) from 4.2.1 to 4.3.0.
- [Release notes](https://github.com/fastify/light-my-request/releases)
- [Commits](https://github.com/fastify/light-my-request/compare/v4.2.1...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 05:13:08 +00:00
dependabot[bot]
f52f859577 chore(deps-dev): bump gulp-sourcemaps from 2.6.5 to 3.0.0
Bumps [gulp-sourcemaps](https://github.com/gulp-sourcemaps/gulp-sourcemaps) from 2.6.5 to 3.0.0.
- [Release notes](https://github.com/gulp-sourcemaps/gulp-sourcemaps/releases)
- [Commits](https://github.com/gulp-sourcemaps/gulp-sourcemaps/compare/v2.6.5...v3.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-25 05:10:00 +00:00
Renovate Bot
68617d6237 chore(deps): update dependency @babel/core to v7.12.9 2020-11-24 21:59:03 +00:00
Kamil Myśliwiec
cf2fbb9a3b fix(common): respect NO_COLOR env variable 2020-11-24 10:49:35 +01:00
Kamil Myśliwiec
8a7b1325fb fix(core): await dynamic module imports #5774 2020-11-24 09:43:01 +01:00
Kamil Mysliwiec
b6837fa462 Merge pull request #5764 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo to v7.12.8
2020-11-24 08:34:23 +01:00
Kamil Mysliwiec
49fc64809e Merge pull request #5766 from nestjs/dependabot/npm_and_yarn/types/reflect-metadata-0.1.0
chore(deps-dev): bump @types/reflect-metadata from 0.0.5 to 0.1.0
2020-11-24 08:34:07 +01:00
Kamil Mysliwiec
9f70e430fa Merge pull request #5769 from nestjs/dependabot/npm_and_yarn/typescript-eslint/parser-4.8.2
chore(deps-dev): bump @typescript-eslint/parser from 4.5.0 to 4.8.2
2020-11-24 08:33:59 +01:00
Kamil Mysliwiec
073a998711 Merge pull request #5771 from nestjs/dependabot/npm_and_yarn/lint-staged-10.5.2
chore(deps-dev): bump lint-staged from 10.5.1 to 10.5.2
2020-11-24 08:33:51 +01:00
Kamil Mysliwiec
66ddc35f3b Merge pull request #5772 from nestjs/dependabot/npm_and_yarn/types/mocha-8.0.4
chore(deps-dev): bump @types/mocha from 8.0.3 to 8.0.4
2020-11-24 08:33:45 +01:00
Kamil Mysliwiec
405851b5f7 Merge pull request #5773 from nestjs/dependabot/npm_and_yarn/typeorm-0.2.29
chore(deps-dev): bump typeorm from 0.2.28 to 0.2.29
2020-11-24 08:33:34 +01:00
dependabot[bot]
69d08f8ae0 chore(deps-dev): bump typeorm from 0.2.28 to 0.2.29
Bumps [typeorm](https://github.com/typeorm/typeorm) from 0.2.28 to 0.2.29.
- [Release notes](https://github.com/typeorm/typeorm/releases)
- [Changelog](https://github.com/typeorm/typeorm/blob/master/CHANGELOG.md)
- [Commits](https://github.com/typeorm/typeorm/compare/0.2.28...0.2.29)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 05:55:22 +00:00
dependabot[bot]
64043196ee chore(deps-dev): bump @types/mocha from 8.0.3 to 8.0.4
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.3 to 8.0.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 05:53:01 +00:00
dependabot[bot]
0c4abea0d3 chore(deps-dev): bump lint-staged from 10.5.1 to 10.5.2
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.1 to 10.5.2.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.5.1...v10.5.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 05:50:46 +00:00
dependabot[bot]
89b421dc9d chore(deps-dev): bump @typescript-eslint/parser from 4.5.0 to 4.8.2
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.5.0 to 4.8.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.8.2/packages/parser)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 05:46:03 +00:00
dependabot[bot]
7c632d3059 chore(deps-dev): bump @types/reflect-metadata from 0.0.5 to 0.1.0
Bumps [@types/reflect-metadata](https://github.com/rbuckton/ReflectDecorators) from 0.0.5 to 0.1.0.
- [Release notes](https://github.com/rbuckton/ReflectDecorators/releases)
- [Changelog](https://github.com/rbuckton/reflect-metadata/blob/master/tsconfig-release.json)
- [Commits](https://github.com/rbuckton/ReflectDecorators/commits/v0.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-24 05:37:19 +00:00
Renovate Bot
d284ce295c chore(deps): update babel monorepo to v7.12.8 2020-11-23 23:01:14 +00:00
Kamil Mysliwiec
fcae42d9f5 Merge pull request #5744 from nestjs/dependabot/npm_and_yarn/graphql-tools-7.0.1
chore(deps-dev): bump graphql-tools from 6.2.4 to 7.0.1
2020-11-23 11:11:43 +01:00
Kamil Mysliwiec
c824870843 Merge pull request #5742 from nestjs/dependabot/npm_and_yarn/supertest-6.0.1
chore(deps-dev): bump supertest from 5.0.0 to 6.0.1
2020-11-23 11:11:28 +01:00
Kamil Mysliwiec
fe7b878946 Merge pull request #5753 from nestjs/dependabot/npm_and_yarn/nestjs/graphql-7.8.2
chore(deps-dev): bump @nestjs/graphql from 7.7.0 to 7.8.2
2020-11-23 11:11:17 +01:00
dependabot[bot]
65c611ed94 chore(deps-dev): bump graphql-tools from 6.2.4 to 7.0.1
Bumps [graphql-tools](https://github.com/ardatan/graphql-tools) from 6.2.4 to 7.0.1.
- [Release notes](https://github.com/ardatan/graphql-tools/releases)
- [Commits](https://github.com/ardatan/graphql-tools/compare/graphql-tools@6.2.4...graphql-tools@7.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 08:16:37 +00:00
dependabot[bot]
781bce0439 chore(deps-dev): bump @nestjs/graphql from 7.7.0 to 7.8.2
Bumps [@nestjs/graphql](https://github.com/nestjs/graphql) from 7.7.0 to 7.8.2.
- [Release notes](https://github.com/nestjs/graphql/releases)
- [Changelog](https://github.com/nestjs/graphql/blob/master/.release-it.json)
- [Commits](https://github.com/nestjs/graphql/compare/7.7.0...7.8.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 08:13:08 +00:00
dependabot[bot]
9a83e04f1b chore(deps-dev): bump supertest from 5.0.0 to 6.0.1
Bumps [supertest](https://github.com/visionmedia/supertest) from 5.0.0 to 6.0.1.
- [Release notes](https://github.com/visionmedia/supertest/releases)
- [Commits](https://github.com/visionmedia/supertest/compare/v5.0.0...v6.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 08:12:51 +00:00
xuzaixian
47f662bdf8 feat(common): move gettimestamp function to class logger 2020-11-11 11:07:29 +08:00
xuzaixian
e3a1fc2c92 feat(common): use internal function as fallback 2020-11-10 18:42:52 +08:00
xuzaixian
d59a06a42a feat(common): timestamp inside log service can be overridden 2020-11-10 17:22:45 +08:00
xuzaixian
c0195a0614 feat(common): timestamp inside log service can be override 2020-11-09 19:59:49 +08:00
Hyuni
1417eeb0a6 Merge pull request #2 from nestjs/master
sync from main repo
2020-11-09 19:41:52 +08:00
Hyuni
47f4e2ec10 Merge pull request #1 from nestjs/master
sync from nest
2020-10-28 16:48:04 +08:00
40 changed files with 2125 additions and 1753 deletions

View File

@@ -237,7 +237,7 @@ Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
```
docs(changelog): update change log to beta.5
bugfix(core): need to depend on latest rxjs and zone.js
fix(core): need to depend on latest rxjs and zone.js
```
### Revert
@@ -249,14 +249,16 @@ If the commit reverts a previous commit, it should begin with `revert:`, followe
Must be one of the following:
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- **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
- **feature**: A new feature
- **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
### Scope

View File

@@ -0,0 +1,38 @@
import { NestExpressApplication } from '@nestjs/platform-express';
import { Test, TestingModule } from '@nestjs/testing';
import { expect } from 'chai';
import * as request from 'supertest';
import { AppModule } from '../src/app.module';
describe('App-level globals (Express Application)', () => {
let moduleFixture: TestingModule;
let app: NestExpressApplication;
beforeEach(async () => {
moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();
});
beforeEach(() => {
app = moduleFixture.createNestApplication<NestExpressApplication>();
});
it('should get "title" from "app.locals"', async () => {
app.setLocal('title', 'My Website');
await app.init();
const response = await request(app.getHttpServer()).get('/').expect(200);
expect(response.body.title).to.equal('My Website');
});
it('should get "email" from "app.locals"', async () => {
app.setLocal('email', 'admin@example.com');
await app.listen(4444);
const response = await request(app.getHttpServer()).get('/').expect(200);
expect(response.body.email).to.equal('admin@example.com');
});
afterEach(async () => {
await app.close();
});
});

View File

@@ -0,0 +1,10 @@
import { Controller, Get, Req } from '@nestjs/common';
import { Request } from 'express';
@Controller()
export class AppController {
@Get()
getGlobals(@Req() req: Request) {
return req.app.locals;
}
}

View File

@@ -0,0 +1,7 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
@Module({
controllers: [AppController],
})
export class AppModule {}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"allowJs": true,
"outDir": "./dist"
},
"include": [
"src/**/*",
"e2e/**/*"
],
"exclude": [
"node_modules"
]
}

View File

@@ -37,6 +37,13 @@ describe('Get URL (Express Application)', () => {
expect(await app.getUrl()).to.be.eql(`http://127.0.0.1:${port}`);
await app.close();
});
it('should return 127.0.0.1 even in a callback', () => {
const app = testModule.createNestApplication(new ExpressAdapter(express()));
return app.listen(port, async () => {
expect(await app.getUrl()).to.be.eql(`http://127.0.0.1:${port}`);
await app.close();
});
});
it('should throw an error for calling getUrl before listen', async () => {
const app = testModule.createNestApplication(new ExpressAdapter(express()));
try {

View File

@@ -30,6 +30,13 @@ describe('Get URL (Fastify Application)', () => {
expect(await app.getUrl()).to.be.eql(`http://127.0.0.1:${port}`);
await app.close();
});
it('should return 127.0.0.1 even in a callback', () => {
const app = testModule.createNestApplication(new FastifyAdapter());
return app.listen(port, async () => {
expect(await app.getUrl()).to.be.eql(`http://127.0.0.1:${port}`);
await app.close();
});
});
it('should throw an error for calling getUrl before listen', async () => {
const app = testModule.createNestApplication(new FastifyAdapter());
try {

3253
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -74,27 +74,27 @@
"@commitlint/cli": "11.0.0",
"@commitlint/config-angular": "11.0.0",
"@grpc/proto-loader": "0.5.5",
"@nestjs/graphql": "7.7.0",
"@nestjs/mongoose": "7.0.2",
"@nestjs/typeorm": "7.1.4",
"@nestjs/graphql": "7.9.1",
"@nestjs/mongoose": "7.1.2",
"@nestjs/typeorm": "7.1.5",
"@types/amqplib": "0.5.16",
"@types/bytes": "3.1.0",
"@types/cache-manager": "2.10.3",
"@types/chai": "4.2.14",
"@types/chai-as-promised": "7.1.3",
"@types/cors": "2.8.8",
"@types/express": "4.17.8",
"@types/express": "4.17.9",
"@types/gulp": "4.0.7",
"@types/mocha": "8.0.3",
"@types/mongoose": "5.7.36",
"@types/node": "14.14.9",
"@types/mocha": "8.0.4",
"@types/mongoose": "5.10.2",
"@types/node": "14.14.10",
"@types/redis": "2.8.28",
"@types/reflect-metadata": "0.0.5",
"@types/sinon": "9.0.8",
"@types/socket.io": "2.1.11",
"@types/ws": "7.2.9",
"@typescript-eslint/eslint-plugin": "4.5.0",
"@typescript-eslint/parser": "4.5.0",
"@types/reflect-metadata": "0.1.0",
"@types/sinon": "9.0.9",
"@types/socket.io": "2.1.12",
"@types/ws": "7.4.0",
"@typescript-eslint/eslint-plugin": "4.9.1",
"@typescript-eslint/parser": "4.9.0",
"amqp-connection-manager": "3.2.1",
"amqplib": "0.6.0",
"apollo-server-express": "2.19.0",
@@ -109,62 +109,62 @@
"commitlint-circle": "1.0.0",
"concurrently": "5.3.0",
"conventional-changelog": "3.1.24",
"core-js": "3.7.0",
"core-js": "3.8.1",
"coveralls": "3.1.0",
"delete-empty": "3.0.0",
"engine.io-client": "4.0.4",
"eslint": "7.14.0",
"eslint-config-prettier": "6.15.0",
"eslint": "7.15.0",
"eslint-config-prettier": "7.0.0",
"eslint-plugin-import": "2.22.1",
"eventsource": "1.0.7",
"fancy-log": "1.3.3",
"fastify": "3.8.0",
"fastify": "3.9.1",
"fastify-cors": "5.0.0",
"fastify-formbody": "5.0.0",
"fastify-multipart": "3.3.0",
"fastify-static": "3.2.1",
"fastify-multipart": "3.3.1",
"fastify-static": "3.3.0",
"graphql": "15.4.0",
"graphql-tools": "6.2.4",
"graphql-tools": "7.0.2",
"grpc": "1.24.4",
"gulp": "4.0.2",
"gulp-clang-format": "1.0.27",
"gulp-clean": "0.4.0",
"gulp-sourcemaps": "2.6.5",
"gulp-sourcemaps": "3.0.0",
"gulp-typescript": "5.0.1",
"gulp-watch": "5.0.1",
"husky": "4.3.0",
"husky": "4.3.5",
"imports-loader": "1.2.0",
"json-loader": "0.5.7",
"kafkajs": "1.12.0",
"lerna": "2.11.0",
"light-my-request": "4.2.1",
"lint-staged": "10.5.1",
"light-my-request": "4.3.0",
"lint-staged": "10.5.3",
"markdown-table": "2.0.0",
"merge-graphql-schemas": "1.7.8",
"middie": "5.2.0",
"mocha": "8.2.1",
"mongoose": "5.10.15",
"mqtt": "4.2.1",
"mongoose": "5.11.5",
"mqtt": "4.2.6",
"multer": "1.4.2",
"mysql": "2.18.1",
"nats": "1.4.12",
"nodemon": "2.0.6",
"nyc": "15.1.0",
"point-of-view": "4.6.0",
"prettier": "2.2.0",
"point-of-view": "4.7.0",
"prettier": "2.2.1",
"redis": "3.0.2",
"rxjs-compat": "6.6.3",
"sinon": "9.2.1",
"sinon-chai": "3.5.0",
"socket.io-client": "2.3.1",
"subscriptions-transport-ws": "0.9.18",
"supertest": "5.0.0",
"ts-morph": "9.0.0",
"ts-node": "9.0.0",
"typeorm": "0.2.28",
"supertest": "6.0.1",
"ts-morph": "9.1.0",
"ts-node": "9.1.1",
"typeorm": "0.2.29",
"typescript": "4.0.3",
"wrk": "1.2.1",
"ws": "7.4.0"
"ws": "7.4.1"
},
"engines": {
"node": ">= 10.13.0"

View File

@@ -3,8 +3,8 @@ import {
PATH_METADATA,
SCOPE_OPTIONS_METADATA,
} from '../../constants';
import { isString, isUndefined } from '../../utils/shared.utils';
import { ScopeOptions } from '../../interfaces/scope-options.interface';
import { isString, isUndefined } from '../../utils/shared.utils';
/**
* Interface defining options that can be passed to `@Controller()` decorator
@@ -18,7 +18,7 @@ export interface ControllerOptions extends ScopeOptions {
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
path?: string;
path?: string | string[];
/**
* Specifies an optional HTTP Request host filter. When configured, methods
@@ -65,7 +65,7 @@ export function Controller(): ClassDecorator;
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param {string} prefix string that defines a `route path prefix`. The prefix
* @param {string, Array} prefix string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
@@ -74,7 +74,7 @@ export function Controller(): ClassDecorator;
*
* @publicApi
*/
export function Controller(prefix: string): ClassDecorator;
export function Controller(prefix: string | string[]): ClassDecorator;
/**
* Decorator that marks a class as a Nest controller that can receive inbound
@@ -137,12 +137,13 @@ export function Controller(options: ControllerOptions): ClassDecorator;
* @publicApi
*/
export function Controller(
prefixOrOptions?: string | ControllerOptions,
prefixOrOptions?: string | string[] | ControllerOptions,
): ClassDecorator {
const defaultPath = '/';
const [path, host, scopeOptions] = isUndefined(prefixOrOptions)
? [defaultPath, undefined, undefined]
: isString(prefixOrOptions)
: isString(prefixOrOptions) || Array.isArray(prefixOrOptions)
? [prefixOrOptions, undefined, undefined]
: [
prefixOrOptions.path || defaultPath,

View File

@@ -2,6 +2,7 @@ export enum HttpStatus {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
PROCESSING = 102,
EARLYHINTS = 103,
OK = 200,
CREATED = 201,
ACCEPTED = 202,

View File

@@ -6,7 +6,7 @@ export interface MiddlewareConfigProxy {
/**
* Excludes routes from the currently processed middleware.
*
* @param {} ...routes
* @param {(string | RouteInfo)[]} routes
* @returns {MiddlewareConfigProxy}
*/
exclude(...routes: (string | RouteInfo)[]): MiddlewareConfigProxy;
@@ -15,7 +15,7 @@ export interface MiddlewareConfigProxy {
* Attaches passed either routes or controllers to the currently configured middleware.
* If you pass a class, Nest would attach middleware to every path defined within this controller.
*
* @param {} ...routes
* @param {(string | Type | RouteInfo)[]} routes
* @returns {MiddlewareConsumer}
*/
forRoutes(...routes: (string | Type<any> | RouteInfo)[]): MiddlewareConsumer;

View File

@@ -10,7 +10,7 @@ import { MiddlewareConfigProxy } from './middleware-config-proxy.interface';
*/
export interface MiddlewareConsumer {
/**
* @param middleware middleware class/function or array of classes/functions
* @param {...(Type | Function)} middleware middleware class/function or array of classes/functions
* to be attached to the passed routes.
*
* @returns {MiddlewareConfigProxy}

View File

@@ -21,7 +21,7 @@ export interface INestApplication extends INestApplicationContext {
* A wrapper function around HTTP adapter method: `adapter.use()`.
* Example `app.use(cors())`
*
* @returns {void}
* @returns {this}
*/
use(...args: any[]): this;
@@ -35,10 +35,10 @@ export interface INestApplication extends INestApplicationContext {
/**
* Starts the application.
*
* @param {number} port
* @param {string} hostname
* @param {Function} callback Optional callback
* @returns A Promise that, when resolved, is a reference to the underlying HttpServer.
* @param {number|string} port
* @param {string} [hostname]
* @param {Function} [callback] Optional callback
* @returns {Promise} A Promise that, when resolved, is a reference to the underlying HttpServer.
*/
listen(port: number | string, callback?: () => void): Promise<any>;
listen(
@@ -50,15 +50,15 @@ export interface INestApplication extends INestApplicationContext {
/**
* Returns the url the application is listening at, based on OS and IP version. Returns as an IP value either in IPv6 or IPv4
*
* @returns The IP where the server is listening
* @returns {Promise<string>} The IP where the server is listening
*/
getUrl(): Promise<string>;
/**
* Starts the application (can be awaited).
*
* @param {number} port
* @param {string} hostname (optional)
* @param {number|string} port
* @param {string} [hostname]
* @returns {Promise}
*/
listenAsync(port: number | string, hostname?: string): Promise<any>;
@@ -66,17 +66,17 @@ export interface INestApplication extends INestApplicationContext {
/**
* Registers a prefix for every HTTP route path.
*
* @param {string} prefix The prefix for every HTTP route path (for example `/v1/api`)
* @returns {void}
* @param {string} prefix The prefix for every HTTP route path (for example `/v1/api`)
* @returns {this}
*/
setGlobalPrefix(prefix: string): this;
/**
* Setup Ws Adapter which will be used inside Gateways.
* Register Ws Adapter which will be used inside Gateways.
* Use when you want to override default `socket.io` library.
*
* @param {WebSocketAdapter} adapter
* @returns {void}
* @param {WebSocketAdapter} adapter
* @returns {this}
*/
useWebSocketAdapter(adapter: WebSocketAdapter): this;
@@ -84,8 +84,9 @@ export interface INestApplication extends INestApplicationContext {
* Connects microservice to the NestApplication instance. Transforms application
* to a hybrid instance.
*
* @param {T} options Microservice options object
* @param {NestHybridApplicationOptions} hybridOptions Hybrid options object
* @template {object} T
* @param {T} options Microservice options object
* @param {NestHybridApplicationOptions} hybridOptions Hybrid options object
* @returns {INestMicroservice}
*/
connectMicroservice<T extends object = any>(
@@ -103,7 +104,7 @@ export interface INestApplication extends INestApplicationContext {
/**
* Returns the underlying native HTTP server.
*
* @returns {any}
* @returns {*}
*/
getHttpServer(): any;
@@ -117,8 +118,8 @@ export interface INestApplication extends INestApplicationContext {
/**
* Starts all connected microservices asynchronously.
*
* @param {Function} callback Optional callback function
* @returns {void}
* @param {Function} [callback] Optional callback function
* @returns {this}
*/
startAllMicroservices(callback?: () => void): this;
@@ -133,14 +134,14 @@ export interface INestApplication extends INestApplicationContext {
* Registers exception filters as global filters (will be used within
* every HTTP route handler)
*
* @param {ExceptionFilter[]} ...filters
* @param {...ExceptionFilter} filters
*/
useGlobalFilters(...filters: ExceptionFilter[]): this;
/**
* Registers pipes as global pipes (will be used within every HTTP route handler)
*
* @param {PipeTransform[]} ...pipes
* @param {...PipeTransform} pipes
*/
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
@@ -148,14 +149,14 @@ export interface INestApplication extends INestApplicationContext {
* Registers interceptors as global interceptors (will be used within
* every HTTP route handler)
*
* @param {NestInterceptor[]} ...interceptors
* @param {...NestInterceptor} interceptors
*/
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
/**
* Registers guards as global guards (will be used within every HTTP route handler)
*
* @param {CanActivate[]} ...guards
* @param {...CanActivate} guards
*/
useGlobalGuards(...guards: CanActivate[]): this;

View File

@@ -14,11 +14,10 @@ export interface INestMicroservice extends INestApplicationContext {
/**
* Starts the microservice.
*
* @param {Function} callback
* @returns {Promise}
*
* @param {Function} callback
* @returns {void}
*/
listen(callback: () => void): any;
listen(callback: () => void): void;
/**
* Starts the microservice (can be awaited).
@@ -29,38 +28,38 @@ export interface INestMicroservice extends INestApplicationContext {
/**
* Register Ws Adapter which will be used inside Gateways.
* Use, when you want to override default `socket.io` library.
* Use when you want to override default `socket.io` library.
*
* @param {WebSocketAdapter} adapter
* @returns {void}
* @param {WebSocketAdapter} adapter
* @returns {this}
*/
useWebSocketAdapter(adapter: WebSocketAdapter): this;
/**
* Registers exception filters as a global filters (will be used within every message pattern handler)
* Registers exception filters as global filters (will be used within every message pattern handler)
*
* @param {ExceptionFilter[]} ...filters
* @param {...ExceptionFilter} filters
*/
useGlobalFilters(...filters: ExceptionFilter[]): this;
/**
* Registers pipes as a global pipes (will be used within every message pattern handler)
* Registers pipes as global pipes (will be used within every message pattern handler)
*
* @param {PipeTransform[]} ...pipes
* @param {...PipeTransform} pipes
*/
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
/**
* Registers interceptors as a global interceptors (will be used within every message pattern handler)
* Registers interceptors as global interceptors (will be used within every message pattern handler)
*
* @param {NestInterceptor[]} ...interceptors
* @param {...NestInterceptor} interceptors
*/
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
/**
* Registers guards as a global guards (will be used within every message pattern handler)
* Registers guards as global guards (will be used within every message pattern handler)
*
* @param {CanActivate[]} ...guards
* @param {...CanActivate} guards
*/
useGlobalGuards(...guards: CanActivate[]): this;

View File

@@ -25,7 +25,7 @@ export class Logger implements LoggerService {
'verbose',
];
private static lastTimestamp?: number;
private static instance?: typeof Logger | LoggerService = Logger;
protected static instance?: typeof Logger | LoggerService = Logger;
constructor(
@Optional() protected context?: string,
@@ -61,6 +61,10 @@ export class Logger implements LoggerService {
this.context = context;
}
getTimestamp() {
return Logger.getTimestamp();
}
static overrideLogger(logger: LoggerService | LogLevel[] | boolean) {
if (Array.isArray(logger)) {
this.logLevels = logger;
@@ -95,6 +99,18 @@ export class Logger implements LoggerService {
this.printMessage(message, clc.cyanBright, context, isTimeDiffEnabled);
}
static getTimestamp() {
const localeStringOptions = {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
};
return new Date(Date.now()).toLocaleString(undefined, localeStringOptions);
}
private callFunction(
name: 'log' | 'warn' | 'debug' | 'verbose',
message: any,
@@ -114,7 +130,7 @@ export class Logger implements LoggerService {
);
}
private getInstance(): typeof Logger | LoggerService {
protected getInstance(): typeof Logger | LoggerService {
const { instance } = Logger;
return instance === this ? Logger : instance;
}
@@ -133,25 +149,12 @@ export class Logger implements LoggerService {
? `${color('Object:')}\n${JSON.stringify(message, null, 2)}\n`
: color(message);
const localeStringOptions = {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
};
const timestamp = new Date(Date.now()).toLocaleString(
undefined,
localeStringOptions,
);
const pidMessage = color(`[Nest] ${process.pid} - `);
const contextMessage = context ? yellow(`[${context}] `) : '';
const timestampDiff = this.updateAndGetTimestampDiff(isTimeDiffEnabled);
const instance = this.instance as typeof Logger;
process.stdout.write(
`${pidMessage}${timestamp} ${contextMessage}${output}${timestampDiff}\n`,
`${pidMessage}${instance.getTimestamp()} ${contextMessage}${output}${timestampDiff}\n`,
);
}

View File

@@ -1,14 +1,14 @@
import { expect } from 'chai';
import {
isUndefined,
isFunction,
isObject,
isString,
addLeadingSlash,
isConstructor,
validatePath,
isNil,
isEmpty,
isFunction,
isNil,
isObject,
isPlainObject,
isString,
isUndefined,
} from '../../utils/shared.utils';
function Foo(a) {
@@ -81,17 +81,17 @@ describe('Shared utils', () => {
expect(isConstructor('nope')).to.be.false;
});
});
describe('validatePath', () => {
describe('addLeadingSlash', () => {
it('should returns validated path ("add / if not exists")', () => {
expect(validatePath('nope')).to.be.eql('/nope');
expect(addLeadingSlash('nope')).to.be.eql('/nope');
});
it('should returns same path', () => {
expect(validatePath('/nope')).to.be.eql('/nope');
expect(addLeadingSlash('/nope')).to.be.eql('/nope');
});
it('should returns empty path', () => {
expect(validatePath('')).to.be.eql('');
expect(validatePath(null)).to.be.eql('');
expect(validatePath(undefined)).to.be.eql('');
expect(addLeadingSlash('')).to.be.eql('');
expect(addLeadingSlash(null)).to.be.eql('');
expect(addLeadingSlash(undefined)).to.be.eql('');
});
});
describe('isNil', () => {

View File

@@ -1,8 +1,16 @@
type ColorTextFn = (text: string) => string;
const isColorAllowed = () => !process.env.NO_COLOR;
const colorIfAllowed = (colorFn: ColorTextFn) => (text: string) =>
isColorAllowed() ? colorFn(text) : text;
export const clc = {
green: (text: string) => `\x1B[32m${text}\x1B[39m`,
yellow: (text: string) => `\x1B[33m${text}\x1B[39m`,
red: (text: string) => `\x1B[31m${text}\x1B[39m`,
magentaBright: (text: string) => `\x1B[95m${text}\x1B[39m`,
cyanBright: (text: string) => `\x1B[96m${text}\x1B[39m`,
green: colorIfAllowed((text: string) => `\x1B[32m${text}\x1B[39m`),
yellow: colorIfAllowed((text: string) => `\x1B[33m${text}\x1B[39m`),
red: colorIfAllowed((text: string) => `\x1B[31m${text}\x1B[39m`),
magentaBright: colorIfAllowed((text: string) => `\x1B[95m${text}\x1B[39m`),
cyanBright: colorIfAllowed((text: string) => `\x1B[96m${text}\x1B[39m`),
};
export const yellow = (text: string) => `\x1B[38;5;3m${text}\x1B[39m`;
export const yellow = colorIfAllowed(
(text: string) => `\x1B[38;5;3m${text}\x1B[39m`,
);

View File

@@ -24,7 +24,7 @@ export const isPlainObject = (fn: any): fn is object => {
);
};
export const validatePath = (path?: string): string =>
export const addLeadingSlash = (path?: string): string =>
path ? (path.charAt(0) !== '/' ? '/' + path : path) : '';
export const isFunction = (fn: any): boolean => typeof fn === 'function';

View File

@@ -6,7 +6,10 @@ import {
} from '@nestjs/common/interfaces/middleware/middleware-configuration.interface';
import { NestMiddleware } from '@nestjs/common/interfaces/middleware/nest-middleware.interface';
import { NestModule } from '@nestjs/common/interfaces/modules/nest-module.interface';
import { isUndefined, validatePath } from '@nestjs/common/utils/shared.utils';
import {
addLeadingSlash,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { ApplicationConfig } from '../application-config';
import { InvalidMiddlewareException } from '../errors/exceptions/invalid-middleware.exception';
import { RuntimeException } from '../errors/exceptions/runtime.exception';
@@ -265,7 +268,7 @@ export class MiddlewareModule {
) => void,
) {
const prefix = this.config.getGlobalPrefix();
const basePath = validatePath(prefix);
const basePath = addLeadingSlash(prefix);
if (basePath && path === '/*') {
// strip slash when a wildcard is being used
// and global prefix has been set

View File

@@ -2,9 +2,9 @@ import { RequestMethod } from '@nestjs/common';
import { PATH_METADATA } from '@nestjs/common/constants';
import { RouteInfo, Type } from '@nestjs/common/interfaces';
import {
addLeadingSlash,
isString,
isUndefined,
validatePath,
} from '@nestjs/common/utils/shared.utils';
import { NestContainer } from '../injector/container';
import { MetadataScanner } from '../metadata-scanner';
@@ -64,11 +64,11 @@ export class RoutesMapper {
}
private validateGlobalPath(path: string): string {
const prefix = validatePath(path);
const prefix = addLeadingSlash(path);
return prefix === '/' ? '' : prefix;
}
private validateRoutePath(path: string): string {
return validatePath(path);
return addLeadingSlash(path);
}
}

View File

@@ -13,7 +13,7 @@ import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.int
import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
import { Logger } from '@nestjs/common/services/logger.service';
import { loadPackage } from '@nestjs/common/utils/load-package.util';
import { isObject, validatePath } from '@nestjs/common/utils/shared.utils';
import { addLeadingSlash, isObject } from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { platform } from 'os';
import { AbstractHttpAdapter } from './adapters';
@@ -164,7 +164,7 @@ export class NestApplication
await this.registerMiddleware(this.httpAdapter);
const prefix = this.config.getGlobalPrefix();
const basePath = validatePath(prefix);
const basePath = addLeadingSlash(prefix);
this.routesResolver.resolve(this.httpAdapter, basePath);
}
@@ -239,8 +239,8 @@ export class NestApplication
): Promise<any>;
public async listen(port: number | string, ...args: any[]): Promise<any> {
!this.isInitialized && (await this.init());
this.httpAdapter.listen(port, ...args);
this.isListening = true;
this.httpAdapter.listen(port, ...args);
return this.httpServer;
}

View File

@@ -6,9 +6,9 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.int
import { Type } from '@nestjs/common/interfaces/type.interface';
import { Logger } from '@nestjs/common/services/logger.service';
import {
addLeadingSlash,
isString,
isUndefined,
validatePath,
} from '@nestjs/common/utils/shared.utils';
import * as pathToRegexp from 'path-to-regexp';
import { ApplicationConfig } from '../application-config';
@@ -87,20 +87,20 @@ export class RouterExplorer {
);
}
public extractRouterPath(
metatype: Type<Controller>,
prefix?: string,
): string {
public extractRouterPath(metatype: Type<Controller>, prefix = ''): string[] {
let path = Reflect.getMetadata(PATH_METADATA, metatype);
if (prefix) path = prefix + this.validateRoutePath(path);
return this.validateRoutePath(path);
}
public validateRoutePath(path: string): string {
if (isUndefined(path)) {
throw new UnknownRequestMappingException();
}
return validatePath(path);
if (Array.isArray(path)) {
path = path.map(p => prefix + addLeadingSlash(p));
} else {
path = [prefix + addLeadingSlash(path)];
}
return path.map(p => addLeadingSlash(p));
}
public scanForPaths(
@@ -134,8 +134,8 @@ export class RouterExplorer {
targetCallback,
);
const path = isString(routePath)
? [this.validateRoutePath(routePath)]
: routePath.map(p => this.validateRoutePath(p));
? [addLeadingSlash(routePath)]
: routePath.map(p => addLeadingSlash(p));
return {
path,
requestMethod,

View File

@@ -60,24 +60,27 @@ export class RoutesResolver implements Resolver {
const { metatype } = instanceWrapper;
const host = this.getHostMetadata(metatype);
const path = this.routerExplorer.extractRouterPath(
const paths = this.routerExplorer.extractRouterPath(
metatype as Type<any>,
basePath,
);
const controllerName = metatype.name;
this.logger.log(
CONTROLLER_MAPPING_MESSAGE(
controllerName,
this.routerExplorer.stripEndSlash(path),
),
);
this.routerExplorer.explore(
instanceWrapper,
moduleName,
applicationRef,
path,
host,
);
paths.forEach(path => {
this.logger.log(
CONTROLLER_MAPPING_MESSAGE(
controllerName,
this.routerExplorer.stripEndSlash(path),
),
);
this.routerExplorer.explore(
instanceWrapper,
moduleName,
applicationRef,
path,
host,
);
});
});
}

View File

@@ -58,7 +58,7 @@ export class SseStream extends Transform {
Connection: 'keep-alive',
// Disable cache, even for old browsers and proxies
'Cache-Control':
'private, no-cache, no-store, must-revalidate, max-age=0',
'private, no-cache, no-store, must-revalidate, max-age=0, no-transform',
'Transfer-Encoding': 'identity',
Pragma: 'no-cache',
Expire: '0',

View File

@@ -37,14 +37,14 @@ import { iterate } from 'iterare';
import { ApplicationConfig } from './application-config';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from './constants';
import { CircularDependencyException } from './errors/exceptions/circular-dependency.exception';
import { InvalidModuleException } from './errors/exceptions/invalid-module.exception';
import { UndefinedModuleException } from './errors/exceptions/undefined-module.exception';
import { getClassScope } from './helpers/get-class-scope';
import { ModulesContainer } from './injector';
import { NestContainer } from './injector/container';
import { InstanceWrapper } from './injector/instance-wrapper';
import { Module } from './injector/module';
import { MetadataScanner } from './metadata-scanner';
import { InvalidModuleException } from './errors/exceptions/invalid-module.exception';
import { UndefinedModuleException } from './errors/exceptions/undefined-module.exception';
interface ApplicationProviderWrapper {
moduleKey: string;
@@ -72,40 +72,53 @@ export class DependenciesScanner {
}
public async scanForModules(
module: ForwardReference | Type<unknown> | DynamicModule,
moduleDefinition:
| ForwardReference
| Type<unknown>
| DynamicModule
| Promise<DynamicModule>,
scope: Type<unknown>[] = [],
ctxRegistry: (ForwardReference | DynamicModule | Type<unknown>)[] = [],
): Promise<Module> {
const moduleInstance = await this.insertModule(module, scope);
ctxRegistry.push(module);
const moduleInstance = await this.insertModule(moduleDefinition, scope);
moduleDefinition =
moduleDefinition instanceof Promise
? await moduleDefinition
: moduleDefinition;
ctxRegistry.push(moduleDefinition);
if (this.isForwardReference(module)) {
module = (module as ForwardReference).forwardRef();
if (this.isForwardReference(moduleDefinition)) {
moduleDefinition = (moduleDefinition as ForwardReference).forwardRef();
}
const modules = !this.isDynamicModule(module as Type<any> | DynamicModule)
? this.reflectMetadata(module as Type<any>, MODULE_METADATA.IMPORTS)
const modules = !this.isDynamicModule(
moduleDefinition as Type<any> | DynamicModule,
)
? this.reflectMetadata(
moduleDefinition as Type<any>,
MODULE_METADATA.IMPORTS,
)
: [
...this.reflectMetadata(
(module as DynamicModule).module,
(moduleDefinition as DynamicModule).module,
MODULE_METADATA.IMPORTS,
),
...((module as DynamicModule).imports || []),
...((moduleDefinition as DynamicModule).imports || []),
];
for (const [index, innerModule] of modules.entries()) {
// In case of a circular dependency (ES module system), JavaScript will resolve the type to `undefined`.
if (innerModule === undefined) {
throw new UndefinedModuleException(module, index, scope);
throw new UndefinedModuleException(moduleDefinition, index, scope);
}
if (!innerModule) {
throw new InvalidModuleException(module, index, scope);
throw new InvalidModuleException(moduleDefinition, index, scope);
}
if (ctxRegistry.includes(innerModule)) {
continue;
}
await this.scanForModules(
innerModule,
[].concat(scope, module),
[].concat(scope, moduleDefinition),
ctxRegistry,
);
}

View File

@@ -21,7 +21,7 @@ describe('InstanceWrapper', () => {
expect(instance.scope).to.be.eql(partial.scope);
expect(instance.metatype).to.be.eql(partial.metatype);
});
it('should set intance by context id', () => {
it('should set instance by context id', () => {
const instance = new InstanceWrapper(partial);
expect(

View File

@@ -32,6 +32,21 @@ describe('RouterExplorer', () => {
public getTestUsingArray() {}
}
@Controller(['global', 'global-alias'])
class TestRouteAlias {
@Get('test')
public getTest() {}
@Post('test')
public postTest() {}
@All('another-test')
public anotherTest() {}
@Get(['foo', 'bar'])
public getTestUsingArray() {}
}
let routerBuilder: RouterExplorer;
let injector: Injector;
let exceptionsFilter: RouterExceptionFilters;
@@ -70,6 +85,22 @@ describe('RouterExplorer', () => {
expect(paths[2].requestMethod).to.eql(RequestMethod.ALL);
expect(paths[3].requestMethod).to.eql(RequestMethod.GET);
});
it('should method return expected list of route paths alias', () => {
const paths = routerBuilder.scanForPaths(new TestRouteAlias());
expect(paths).to.have.length(4);
expect(paths[0].path).to.eql(['/test']);
expect(paths[1].path).to.eql(['/test']);
expect(paths[2].path).to.eql(['/another-test']);
expect(paths[3].path).to.eql(['/foo', '/bar']);
expect(paths[0].requestMethod).to.eql(RequestMethod.GET);
expect(paths[1].requestMethod).to.eql(RequestMethod.POST);
expect(paths[2].requestMethod).to.eql(RequestMethod.ALL);
expect(paths[3].requestMethod).to.eql(RequestMethod.GET);
});
});
describe('exploreMethodMetadata', () => {
@@ -87,6 +118,20 @@ describe('RouterExplorer', () => {
expect(route.requestMethod).to.eql(RequestMethod.GET);
});
it('should method return expected object which represent single route with alias', () => {
const instance = new TestRouteAlias();
const instanceProto = Object.getPrototypeOf(instance);
const route = routerBuilder.exploreMethodMetadata(
new TestRouteAlias(),
instanceProto,
'getTest',
);
expect(route.path).to.eql(['/test']);
expect(route.requestMethod).to.eql(RequestMethod.GET);
});
it('should method return expected object which represent multiple routes', () => {
const instance = new TestRoute();
const instanceProto = Object.getPrototypeOf(instance);
@@ -100,6 +145,20 @@ describe('RouterExplorer', () => {
expect(route.path).to.eql(['/foo', '/bar']);
expect(route.requestMethod).to.eql(RequestMethod.GET);
});
it('should method return expected object which represent multiple routes with alias', () => {
const instance = new TestRouteAlias();
const instanceProto = Object.getPrototypeOf(instance);
const route = routerBuilder.exploreMethodMetadata(
new TestRouteAlias(),
instanceProto,
'getTestUsingArray',
);
expect(route.path).to.eql(['/foo', '/bar']);
expect(route.requestMethod).to.eql(RequestMethod.GET);
});
});
describe('applyPathsToRouterProxy', () => {
@@ -130,14 +189,20 @@ describe('RouterExplorer', () => {
describe('extractRouterPath', () => {
it('should return expected path', () => {
expect(routerBuilder.extractRouterPath(TestRoute)).to.be.eql('/global');
expect(routerBuilder.extractRouterPath(TestRoute, '/module')).to.be.eql(
expect(routerBuilder.extractRouterPath(TestRoute)).to.be.eql(['/global']);
expect(routerBuilder.extractRouterPath(TestRoute, '/module')).to.be.eql([
'/module/global',
);
]);
});
it('should throw it a there is a bad path expected path', () => {
expect(() => routerBuilder.validateRoutePath(undefined)).to.throw();
it('should return expected path with alias', () => {
expect(routerBuilder.extractRouterPath(TestRouteAlias)).to.be.eql([
'/global',
'/global-alias',
]);
expect(
routerBuilder.extractRouterPath(TestRouteAlias, '/module'),
).to.be.eql(['/module/global', '/module/global-alias']);
});
});

View File

@@ -88,7 +88,7 @@ describe('RoutesResolver', () => {
sinon
.stub((routesResolver as any).routerExplorer, 'extractRouterPath')
.callsFake(() => '');
.callsFake(() => ['']);
routesResolver.registerRouters(routes, moduleName, '', appInstance);
expect(exploreSpy.called).to.be.true;
@@ -114,7 +114,7 @@ describe('RoutesResolver', () => {
sinon
.stub((routesResolver as any).routerExplorer, 'extractRouterPath')
.callsFake(() => '');
.callsFake(() => ['']);
routesResolver.registerRouters(routes, moduleName, '', appInstance);
expect(exploreSpy.called).to.be.true;

View File

@@ -1,4 +1,8 @@
import { isString, isUndefined } from '@nestjs/common/utils/shared.utils';
import {
isNil,
isString,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { Observable } from 'rxjs';
import {
CONNECT_EVENT,
@@ -111,6 +115,9 @@ export class ServerRMQ extends Server implements CustomTransportStrategy {
message: Record<string, any>,
channel: any,
): Promise<void> {
if (isNil(message)) {
return;
}
const { content, properties } = message;
const rawMessage = JSON.parse(content.toString());
const packet = this.deserializer.deserialize(rawMessage);

View File

@@ -95,7 +95,9 @@ export abstract class Server {
): Promise<any> {
const handler = this.getHandlerByPattern(pattern);
if (!handler) {
return this.logger.error(NO_EVENT_HANDLER);
return this.logger.error(
`${NO_EVENT_HANDLER} Event pattern: ${JSON.stringify(pattern)}.`,
);
}
const resultOrStream = await handler(packet.data, context);
if (this.isObservable(resultOrStream)) {

View File

@@ -142,6 +142,11 @@ export class ExpressAdapter extends AbstractHttpAdapter {
.forEach(parserKey => this.use(parserMiddleware[parserKey]));
}
public setLocal(key: string, value: any) {
this.instance.locals[key] = value;
return this;
}
public getType(): string {
return 'express';
}

View File

@@ -75,4 +75,16 @@ export interface NestExpressApplication extends INestApplication {
* @returns {this}
*/
setViewEngine(engine: string): this;
/**
* Sets app-level globals for view templates.
*
* @example
* app.setLocal('title', 'My Site')
*
* @see https://expressjs.com/en/4x/api.html#app.locals
*
* @returns {this}
*/
setLocal(key: string, value: any): this;
}

View File

@@ -59,12 +59,8 @@ type FastifyHttpsOptions<
export class FastifyAdapter<
TServer extends RawServerBase = RawServerDefault,
TRawRequest extends RawRequestDefaultExpression<
TServer
> = RawRequestDefaultExpression<TServer>,
TRawResponse extends RawReplyDefaultExpression<
TServer
> = RawReplyDefaultExpression<TServer>
TRawRequest extends RawRequestDefaultExpression<TServer> = RawRequestDefaultExpression<TServer>,
TRawResponse extends RawReplyDefaultExpression<TServer> = RawReplyDefaultExpression<TServer>
> extends AbstractHttpAdapter<
TServer,
FastifyRequest<RequestGenericInterface, TServer, TRawRequest>,
@@ -113,9 +109,6 @@ export class FastifyAdapter<
callback?: () => void,
): void;
public listen(port: string | number, ...args: any[]): Promise<string> {
if (typeof port === 'string') {
port = parseInt(port);
}
return this.instance.listen(port, ...args);
}

View File

@@ -55,16 +55,16 @@ export interface NestFastifyApplication extends INestApplication {
* @returns A Promise that, when resolved, is a reference to the underlying HttpServer.
*/
listen(
port: number,
port: number | string,
callback?: (err: Error, address: string) => void,
): Promise<any>;
listen(
port: number,
port: number | string,
address: string,
callback?: (err: Error, address: string) => void,
): Promise<any>;
listen(
port: number,
port: number | string,
address: string,
backlog: number,
callback?: (err: Error, address: string) => void,

View File

@@ -17,10 +17,10 @@
"access": "public"
},
"dependencies": {
"fastify": "3.8.0",
"fastify": "3.9.1",
"fastify-cors": "5.0.0",
"fastify-formbody": "5.0.0",
"light-my-request": "4.2.1",
"light-my-request": "4.3.0",
"middie": "5.2.0",
"path-to-regexp": "3.2.0",
"tslib": "2.0.3"

View File

@@ -18,7 +18,7 @@
},
"dependencies": {
"tslib": "2.0.3",
"ws": "7.4.0"
"ws": "7.4.1"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",

View File

@@ -1,4 +1,4 @@
import { validatePath } from '@nestjs/common/utils/shared.utils';
import { addLeadingSlash } from '@nestjs/common/utils/shared.utils';
import { ApplicationConfig } from '@nestjs/core/application-config';
import { isString } from 'util';
import { GatewayMetadata } from './interfaces/gateway-metadata.interface';
@@ -74,6 +74,6 @@ export class SocketServerProvider {
if (!isString(namespace)) {
return namespace;
}
return validatePath(namespace);
return addLeadingSlash(namespace);
}
}

View File

@@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@babel/cli": {
"version": "7.12.7",
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.12.7.tgz",
"integrity": "sha512-vE1fidQsaWnQVs4SItkuCdi3+uXqjbhw4cIKp8aawKxOnTnlvxYMzXSeMAqo6alldQRFQYb198YQfW0Sp1jl5Q==",
"version": "7.12.8",
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.12.8.tgz",
"integrity": "sha512-/6nQj11oaGhLmZiuRUfxsujiPDc9BBReemiXgIbxc+M5W+MIiFKYwvNDJvBfnGKNsJTKbUfEheKc9cwoPHAVQA==",
"dev": true,
"requires": {
"@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents",
@@ -46,9 +46,9 @@
"dev": true
},
"@babel/core": {
"version": "7.12.7",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.7.tgz",
"integrity": "sha512-tRKx9B53kJe8NCGGIxEQb2Bkr0riUIEuN7Sc1fxhs5H8lKlCWUvQCSNMVIB0Meva7hcbCRJ76de15KoLltdoqw==",
"version": "7.12.9",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.9.tgz",
"integrity": "sha512-gTXYh3M5wb7FRXQy+FErKFAv90BnlOuNn1QkCK2lREoPAjrQCO49+HVSrFoe5uakFAF5eenS75KbO2vQiLrTMQ==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
@@ -57,7 +57,7 @@
"@babel/helpers": "^7.12.5",
"@babel/parser": "^7.12.7",
"@babel/template": "^7.12.7",
"@babel/traverse": "^7.12.7",
"@babel/traverse": "^7.12.9",
"@babel/types": "^7.12.7",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
@@ -98,9 +98,9 @@
}
},
"@babel/traverse": {
"version": "7.12.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.7.tgz",
"integrity": "sha512-nMWaqsQEeSvMNypswUDzjqQ+0rR6pqCtoQpsqGJC4/Khm9cISwPTSpai57F6/jDaOoEGz8yE/WxcO3PV6tKSmQ==",
"version": "7.12.9",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
"integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
@@ -819,9 +819,9 @@
"dev": true
},
"@babel/traverse": {
"version": "7.12.7",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.7.tgz",
"integrity": "sha512-nMWaqsQEeSvMNypswUDzjqQ+0rR6pqCtoQpsqGJC4/Khm9cISwPTSpai57F6/jDaOoEGz8yE/WxcO3PV6tKSmQ==",
"version": "7.12.9",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
"integrity": "sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",

View File

@@ -22,8 +22,8 @@
"rxjs": "6.6.3"
},
"devDependencies": {
"@babel/cli": "7.12.7",
"@babel/core": "7.12.7",
"@babel/cli": "7.12.8",
"@babel/core": "7.12.9",
"@babel/node": "7.12.6",
"@babel/plugin-proposal-decorators": "7.12.1",
"@babel/plugin-transform-runtime": "7.12.1",