Compare commits

...

603 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
Kamil Myśliwiec
c39f1c7970 chore(@nestjs) publish v7.5.5 release 2020-11-23 09:52:34 +01:00
Kamil Mysliwiec
35c0a7f326 Merge pull request #5719 from BerniWittmann/master
feat(common): await for exception factory in validation pipe
2020-11-23 09:49:51 +01:00
Kamil Mysliwiec
178b6062a6 Merge pull request #5723 from zub0r/master
Added missing options to for NATS client to use jwt
2020-11-23 09:49:40 +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
Kamil Mysliwiec
91ab18b895 Merge pull request #5752 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo to v7.12.7
2020-11-23 08:29:29 +01:00
Kamil Mysliwiec
2e45cbf779 Merge pull request #5755 from nestjs/dependabot/npm_and_yarn/fast-json-stringify-2.2.10
chore(deps): bump fast-json-stringify from 2.2.9 to 2.2.10
2020-11-23 08:28:56 +01:00
Kamil Mysliwiec
3614db5eb9 Merge pull request #5756 from nestjs/dependabot/npm_and_yarn/graphql-15.4.0
chore(deps-dev): bump graphql from 15.3.0 to 15.4.0
2020-11-23 08:28:49 +01:00
Kamil Mysliwiec
3a1c4eab9e Merge pull request #5757 from nestjs/dependabot/npm_and_yarn/eslint-7.14.0
chore(deps-dev): bump eslint from 7.10.0 to 7.14.0
2020-11-23 08:25:03 +01:00
Kamil Mysliwiec
3632357078 Merge pull request #5759 from nestjs/dependabot/npm_and_yarn/fastify-cors-5.0.0
chore(deps): bump fastify-cors from 4.1.0 to 5.0.0
2020-11-23 08:24:53 +01:00
Kamil Mysliwiec
90999592b3 Merge pull request #5760 from nestjs/dependabot/npm_and_yarn/ts-morph-9.0.0
chore(deps-dev): bump ts-morph from 8.1.2 to 9.0.0
2020-11-23 08:24:46 +01:00
dependabot[bot]
b56a71c549 chore(deps-dev): bump ts-morph from 8.1.2 to 9.0.0
Bumps [ts-morph](https://github.com/dsherret/ts-morph) from 8.1.2 to 9.0.0.
- [Release notes](https://github.com/dsherret/ts-morph/releases)
- [Commits](https://github.com/dsherret/ts-morph/compare/8.1.2...9.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 05:57:21 +00:00
dependabot[bot]
ec960a6262 chore(deps): bump fastify-cors from 4.1.0 to 5.0.0
Bumps [fastify-cors](https://github.com/fastify/fastify-cors) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/fastify/fastify-cors/releases)
- [Commits](https://github.com/fastify/fastify-cors/compare/v4.1.0...v5.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 05:55:22 +00:00
dependabot[bot]
56e9d963d9 chore(deps-dev): bump eslint from 7.10.0 to 7.14.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.10.0 to 7.14.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.10.0...v7.14.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 05:50:17 +00:00
dependabot[bot]
72ad857cb3 chore(deps-dev): bump graphql from 15.3.0 to 15.4.0
Bumps [graphql](https://github.com/graphql/graphql-js) from 15.3.0 to 15.4.0.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v15.3.0...v15.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 05:47:53 +00:00
dependabot[bot]
143d213b2a chore(deps): bump fast-json-stringify from 2.2.9 to 2.2.10
Bumps [fast-json-stringify](https://github.com/fastify/fast-json-stringify) from 2.2.9 to 2.2.10.
- [Release notes](https://github.com/fastify/fast-json-stringify/releases)
- [Commits](https://github.com/fastify/fast-json-stringify/compare/v2.2.9...v2.2.10)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-23 05:44:47 +00:00
Renovate Bot
2ecf431195 chore(deps): update babel monorepo to v7.12.7 2020-11-22 19:34:45 +00:00
Kamil Mysliwiec
404f3f125f Merge pull request #5740 from nestjs/dependabot/npm_and_yarn/prettier-2.2.0
chore(deps-dev): bump prettier from 2.1.2 to 2.2.0
2020-11-22 20:28:19 +01:00
Kamil Mysliwiec
a40aeaa1ac Merge pull request #5741 from nestjs/dependabot/npm_and_yarn/eslint-config-prettier-6.15.0
chore(deps-dev): bump eslint-config-prettier from 6.11.0 to 6.15.0
2020-11-22 20:28:11 +01:00
Kamil Mysliwiec
06e256a45e Merge pull request #5743 from nestjs/dependabot/npm_and_yarn/fastify-3.8.0
chore(deps): bump fastify from 3.7.0 to 3.8.0
2020-11-22 20:28:01 +01:00
Kamil Mysliwiec
9c58e8a838 Merge pull request #5745 from nestjs/dependabot/npm_and_yarn/types/node-14.14.9
chore(deps-dev): bump @types/node from 10.17.3 to 14.14.9
2020-11-22 20:27:44 +01:00
Kamil Mysliwiec
0627dec2aa Merge pull request #5746 from nestjs/dependabot/npm_and_yarn/nuxtjs/opencollective-0.3.2
chore(deps): bump @nuxtjs/opencollective from 0.2.2 to 0.3.2
2020-11-22 20:27:26 +01:00
dependabot[bot]
27d1e7a202 chore(deps): bump @nuxtjs/opencollective from 0.2.2 to 0.3.2
Bumps [@nuxtjs/opencollective](https://github.com/nuxt-contrib/opencollective) from 0.2.2 to 0.3.2.
- [Release notes](https://github.com/nuxt-contrib/opencollective/releases)
- [Changelog](https://github.com/nuxt-contrib/opencollective/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nuxt-contrib/opencollective/compare/v0.2.2...v0.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:20:52 +00:00
dependabot[bot]
a77b1155d1 chore(deps-dev): bump @types/node from 10.17.3 to 14.14.9
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 10.17.3 to 14.14.9.
- [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-20 16:19:52 +00:00
dependabot[bot]
0b4682259e chore(deps-dev): bump prettier from 2.1.2 to 2.2.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.1.2 to 2.2.0.
- [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.1.2...2.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:19:26 +00:00
dependabot[bot]
9acee58108 chore(deps-dev): bump eslint-config-prettier from 6.11.0 to 6.15.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.11.0 to 6.15.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.11.0...v6.15.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:19:13 +00:00
dependabot[bot]
61e2ed9e18 chore(deps): bump fastify from 3.7.0 to 3.8.0
Bumps [fastify](https://github.com/fastify/fastify) from 3.7.0 to 3.8.0.
- [Release notes](https://github.com/fastify/fastify/releases)
- [Commits](https://github.com/fastify/fastify/compare/v3.7.0...v3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:18:21 +00:00
Kamil Mysliwiec
3f57df3301 Merge pull request #5739 from nestjs/dependabot/npm_and_yarn/engine.io-client-4.0.4
chore(deps-dev): bump engine.io-client from 4.0.1 to 4.0.4
2020-11-20 17:16:44 +01:00
Kamil Mysliwiec
bc52688fde Merge pull request #5724 from nestjs/dependabot/npm_and_yarn/lodash-4.17.15
chore(deps): [security] bump lodash from 4.17.11 to 4.17.15
2020-11-20 17:15:25 +01:00
Kamil Mysliwiec
e5471817ed Merge pull request #5731 from nestjs/dependabot/npm_and_yarn/handlebars-4.7.6
chore(deps): [security] bump handlebars from 4.5.3 to 4.7.6
2020-11-20 17:15:11 +01:00
Kamil Mysliwiec
f68634f09e Merge pull request #5732 from nestjs/dependabot/npm_and_yarn/find-my-way-3.0.5
chore(deps): [security] bump find-my-way from 3.0.4 to 3.0.5
2020-11-20 17:14:39 +01:00
dependabot[bot]
29f197f7bf chore(deps-dev): bump engine.io-client from 4.0.1 to 4.0.4
Bumps [engine.io-client](https://github.com/socketio/engine.io-client) from 4.0.1 to 4.0.4.
- [Release notes](https://github.com/socketio/engine.io-client/releases)
- [Changelog](https://github.com/socketio/engine.io-client/blob/master/CHANGELOG.md)
- [Commits](https://github.com/socketio/engine.io-client/compare/4.0.1...4.0.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:14:22 +00:00
Kamil Mysliwiec
a0720c1cc3 Merge pull request #5737 from nestjs/dependabot/npm_and_yarn/grpc-1.24.4
chore(deps-dev): bump grpc from 1.24.3 to 1.24.4
2020-11-20 17:14:20 +01:00
Kamil Mysliwiec
d94a6e8b40 Merge pull request #5733 from nestjs/dependabot/npm_and_yarn/https-proxy-agent-2.2.4
chore(deps): [security] bump https-proxy-agent from 2.2.2 to 2.2.4
2020-11-20 17:14:14 +01:00
Kamil Mysliwiec
cd950eebe1 Merge pull request #5738 from nestjs/dependabot/npm_and_yarn/middie-5.2.0
chore(deps): bump middie from 5.1.0 to 5.2.0
2020-11-20 17:14:09 +01:00
dependabot[bot]
486e11d59b chore(deps): bump middie from 5.1.0 to 5.2.0
Bumps [middie](https://github.com/fastify/middleman) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/fastify/middleman/releases)
- [Commits](https://github.com/fastify/middleman/compare/v5.1.0...v5.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:13:38 +00:00
dependabot[bot]
c59e20f9b5 chore(deps-dev): bump grpc from 1.24.3 to 1.24.4
Bumps [grpc](https://github.com/grpc/grpc-node) from 1.24.3 to 1.24.4.
- [Release notes](https://github.com/grpc/grpc-node/releases)
- [Commits](https://github.com/grpc/grpc-node/compare/grpc@1.24.3...grpc@1.24.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 16:12:30 +00:00
Kamil Mysliwiec
711232f878 Merge pull request #5726 from nestjs/dependabot/npm_and_yarn/mongoose-5.10.15
chore(deps-dev): bump mongoose from 5.10.10 to 5.10.15
2020-11-20 17:10:50 +01:00
Kamil Mysliwiec
d24c3ca435 Merge pull request #5727 from nestjs/dependabot/npm_and_yarn/acorn-5.7.4
chore(deps): [security] bump acorn from 5.7.3 to 5.7.4
2020-11-20 17:10:32 +01:00
Kamil Mysliwiec
1b16efab37 Merge pull request #5728 from nestjs/dependabot/npm_and_yarn/ws-7.4.0
chore(deps): bump ws from 7.3.1 to 7.4.0
2020-11-20 17:10:25 +01:00
Kamil Mysliwiec
278c5e0121 Merge pull request #5735 from nestjs/dependabot/npm_and_yarn/object-path-0.11.5
chore(deps): [security] bump object-path from 0.11.4 to 0.11.5
2020-11-20 17:10:09 +01:00
Kamil Mysliwiec
d496fe8cde Merge pull request #5734 from nestjs/dependabot/npm_and_yarn/mixin-deep-1.3.2
chore(deps): [security] bump mixin-deep from 1.3.1 to 1.3.2
2020-11-20 17:10:01 +01:00
Kamil Mysliwiec
ac9d7ec15e Merge pull request #5736 from nestjs/dependabot/add-v2-config-file
Create Dependabot config file
2020-11-20 17:09:49 +01:00
dependabot-preview[bot]
8ee2ff6f98 Create Dependabot config file 2020-11-20 14:13:05 +00:00
dependabot-preview[bot]
d69222cca7 chore(deps): [security] bump object-path from 0.11.4 to 0.11.5
Bumps [object-path](https://github.com/mariocasciaro/object-path) from 0.11.4 to 0.11.5. **This update includes a security fix.**
- [Release notes](https://github.com/mariocasciaro/object-path/releases)
- [Commits](https://github.com/mariocasciaro/object-path/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:22:01 +00:00
dependabot-preview[bot]
a1dce7deb7 chore(deps): [security] bump mixin-deep from 1.3.1 to 1.3.2
Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2. **This update includes a security fix.**
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:21:08 +00:00
dependabot-preview[bot]
42aecea37d chore(deps): [security] bump https-proxy-agent from 2.2.2 to 2.2.4
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.2 to 2.2.4. **This update includes security fixes.**
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/2.2.2...2.2.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:18:02 +00:00
dependabot-preview[bot]
5837cc7780 chore(deps): [security] bump find-my-way from 3.0.4 to 3.0.5
Bumps [find-my-way](https://github.com/delvedor/find-my-way) from 3.0.4 to 3.0.5. **This update includes a security fix.**
- [Release notes](https://github.com/delvedor/find-my-way/releases)
- [Commits](https://github.com/delvedor/find-my-way/compare/v3.0.4...v3.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:14:04 +00:00
dependabot-preview[bot]
a29efd7b8e chore(deps): [security] bump handlebars from 4.5.3 to 4.7.6
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.5.3 to 4.7.6. **This update includes a security fix.**
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.5.3...v4.7.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:10:38 +00:00
dependabot-preview[bot]
94a7675b9e chore(deps): bump ws from 7.3.1 to 7.4.0
Bumps [ws](https://github.com/websockets/ws) from 7.3.1 to 7.4.0.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.3.1...7.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:08:20 +00:00
dependabot-preview[bot]
b12b410935 chore(deps): [security] bump acorn from 5.7.3 to 5.7.4
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. **This update includes security fixes.**
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:07:55 +00:00
dependabot-preview[bot]
c79b45ae84 chore(deps-dev): bump mongoose from 5.10.10 to 5.10.15
Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.10.10 to 5.10.15.
- [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.10...5.10.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:07:27 +00:00
dependabot-preview[bot]
7a303edc5f chore(deps): [security] bump lodash from 4.17.11 to 4.17.15
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15. **This update includes security fixes.**
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-20 12:06:16 +00:00
Martin H
74659e966c Added missing options to for NATS jwt 2020-11-20 10:04:56 +01:00
Bernhard Wittmann
4f782b9881 feat(common): await for exception factory in validation pipe
allow the usage of asychronouse code in exception factory

fixes #5718
2020-11-19 17:14:40 +01:00
Kamil Myśliwiec
eaeef51003 sample(): fix sse example 2020-11-18 14:28:17 +01:00
Kamil Myśliwiec
604ee86064 chore(@nestjs) publish v7.5.4 release 2020-11-18 14:10:31 +01:00
Kamil Mysliwiec
01dc358aad Merge pull request #5708 from gangajogur/issue-5586
fix(core): add abstract option to resolve method
2020-11-18 14:05:50 +01:00
Kamil Mysliwiec
7f912d7f12 Merge pull request #5712 from mimopo/master
fix: Ack never called when no data sent
2020-11-18 14:05:33 +01:00
Kamil Myśliwiec
55d7b0e890 feat(): add response passthrough configuration property 2020-11-18 14:04:31 +01:00
Miguel Montes
840cef45a4 test: gateway-ack when no data provided on event
Add test to ensure that ack is called even if no data provided on event.
https://github.com/nestjs/nest/issues/5711
2020-11-18 00:14:21 +01:00
Miguel Montes Porras
6bf4b0b24d fix: Ack never called when no data sent
Ack method is never called when no data sent to the event.
https://github.com/nestjs/nest/issues/5711
2020-11-17 21:27:17 +01:00
gangajogur
ad179935f4 fix(core): Add abstract option to resolvePerContext method 2020-11-17 22:02:13 +10:00
Kamil Myśliwiec
8009337e23 chore(@nestjs) publish v7.5.3 release 2020-11-17 12:53:53 +01:00
Kamil Myśliwiec
1ab0f1be33 feat(platform-fastify): add is parser registered getter 2020-11-17 12:51:58 +01:00
Kamil Mysliwiec
3818dec622 Create renovate.json 2020-11-17 12:44:58 +01:00
gangajogur
4f694e213c fix(core): add abstract option to resolve method 2020-11-17 21:40:58 +10:00
Kamil Mysliwiec
f2ca8070e0 Delete renovate.json 2020-11-17 11:53:12 +01:00
Kamil Mysliwiec
a52524ed13 Merge pull request #5687 from robertohuertasm/fix/httpexception
refactor(common): change names of createBody arguments
2020-11-17 08:46:13 +01:00
Roberto Huertas
d429a068b4 refactor(common): change names of createBody arguments
This PR just changes the names of some of the `createBody` method parameters to be consistent with
the names of the parameters used by some of the `HttpException` subclasses.
2020-11-16 20:47:33 +01:00
Kamil Mysliwiec
ae23cc095d Update renovate.json 2020-11-16 09:46:34 +01:00
Kamil Mysliwiec
920255c19f Merge pull request #5703 from nestjs/renovate/configure
Configure Renovate
2020-11-16 09:45:53 +01:00
Renovate Bot
995260afa4 Add renovate.json 2020-11-16 08:12:47 +00:00
Kamil Mysliwiec
bd1488e65d Delete renovate.json 2020-11-16 09:10:19 +01:00
Kamil Myśliwiec
cfd6a659c7 sample(06-mongoose): add cat document type 2020-11-13 15:17:17 +01:00
Kamil Myśliwiec
1b93414117 sample(28-sse): remove controller unit test 2020-11-13 13:48:09 +01:00
Kamil Myśliwiec
0dd7745058 chore(): update readme 2020-11-13 13:14:43 +01:00
Kamil Myśliwiec
281e6cb4f1 chore(@nestjs) publish v7.5.2 release 2020-11-13 13:14:08 +01:00
Kamil Myśliwiec
2adbd1cd7c fix(core): fix see for fastify platform 2020-11-13 13:12:29 +01:00
Kamil Myśliwiec
78cda5f1b4 sample(): rename 28-file-upload to 29-file-upload 2020-11-13 12:14:16 +01:00
Kamil Mysliwiec
d4bec3be0c Merge pull request #5648 from nestjs/renovate/sinon-9.x
chore(deps): update dependency sinon to v9.2.1
2020-11-13 12:08:21 +01:00
Kamil Myśliwiec
66f8247dcb chore(): resolve conflicts 2020-11-13 12:07:22 +01:00
Kamil Mysliwiec
23359de57b Merge pull request #5646 from nestjs/renovate/mocha-8.x
chore(deps): update dependency mocha to v8.2.1
2020-11-13 12:06:40 +01:00
Kamil Myśliwiec
7953a5b0d0 chore(): resolve conflicts 2020-11-13 12:06:09 +01:00
Kamil Mysliwiec
03802d15a7 Merge pull request #5645 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.5.1
2020-11-13 11:59:26 +01:00
Kamil Myśliwiec
d15ea7db3d chore(): resolve conflicts 2020-11-13 11:59:09 +01:00
Kamil Mysliwiec
12d657a949 Merge pull request #5643 from nestjs/renovate/fastify-multipart-3.x
chore(deps): update dependency fastify-multipart to v3.3.0
2020-11-13 11:58:25 +01:00
Kamil Myśliwiec
9212e78fa3 chore(): resolve conflicts 2020-11-13 11:58:07 +01:00
Kamil Mysliwiec
4fbdd2ccac Merge pull request #5405 from nestjs/renovate/engine.io-client-4.x
chore(deps): update dependency engine.io-client to v4
2020-11-13 11:57:18 +01:00
Kamil Myśliwiec
a7e45bdcca chore(): resolve conflicts 2020-11-13 11:57:02 +01:00
Kamil Mysliwiec
b0311b89ee Merge pull request #5657 from nestjs/renovate/axios-0.x
fix(deps): update dependency axios to v0.21.0
2020-11-13 11:55:47 +01:00
Kamil Myśliwiec
a53c20b42f chore(): resolve conflicts 2020-11-13 11:54:57 +01:00
Kamil Mysliwiec
e7e2a1e46d Update renovate.json 2020-11-13 09:25:16 +01:00
Kamil Mysliwiec
98f046c222 Update Readme.md 2020-11-13 09:09:17 +01:00
Kamil Myśliwiec
765ecd3ebb Merge branch 'master' of https://github.com/nestjs/nest 2020-11-12 13:53:16 +01:00
Kamil Myśliwiec
008c6f9f1f sample(26-queues): show bull module for root usage 2020-11-12 13:53:04 +01:00
Kamil Mysliwiec
aad5748f27 Update Readme.md 2020-11-12 11:34:19 +01: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
Kamil Mysliwiec
95f450d10b Merge pull request #5678 from nestjs/renovate/node-14.x
chore(deps): update dependency @types/node to v14.14.7
2020-11-10 08:54:29 +01:00
Renovate Bot
c060bc9196 chore(deps): update dependency @types/node to v14.14.7 2020-11-09 20:02:26 +00: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
Kamil Mysliwiec
9d4fc32c57 Merge pull request #5674 from nestjs/renovate/core-js-3.x
chore(deps): update dependency core-js to v3.7.0
2020-11-06 18:13:27 +01:00
Renovate Bot
7ea7ac8ab5 chore(deps): update dependency core-js to v3.7.0 2020-11-06 15:52:12 +00:00
Kamil Mysliwiec
6f37544ff4 Merge pull request #5670 from almarro1/fix-shutdown-hook-error
fix: verify err variable is defined in catch block
2020-11-05 21:58:28 +01:00
Kamil Mysliwiec
1221c3052e Merge pull request #5672 from nestjs/renovate/amqplib-0.x
chore(deps): update dependency @types/amqplib to v0.5.16
2020-11-05 21:55:07 +01:00
Renovate Bot
52e677a60a chore(deps): update dependency @types/amqplib to v0.5.16 2020-11-05 19:01:21 +00:00
Kamil Mysliwiec
0993b92545 Update renovate.json 2020-11-05 15:23:17 +01:00
Alvaro
9c79e0ee59 fix: verify err variable is defined in catch block 2020-11-05 12:34:47 +01:00
Kamil Mysliwiec
b090c96ec6 Update renovate.json 2020-11-05 09:07:25 +01:00
Kamil Mysliwiec
99c5f3a405 Merge pull request #5665 from nestjs/renovate/nestjs-schematics-7.x
chore(deps): update dependency @nestjs/schematics to v7.2.1
2020-11-05 09:06:59 +01:00
Kamil Myśliwiec
c819b91e08 fix(sample): fix webpack sample 2020-11-05 09:04:59 +01:00
Kamil Myśliwiec
fd9ed91a41 Merge branch 'master' of https://github.com/nestjs/nest 2020-11-05 08:45:50 +01:00
Kamil Mysliwiec
539c94369a Merge pull request #5663 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo
2020-11-05 08:43:37 +01:00
Kamil Mysliwiec
a9b2576c85 Merge pull request #5668 from nestjs/renovate/conventional-changelog-3.x
chore(deps): update dependency conventional-changelog to v3.1.24
2020-11-05 08:43:21 +01:00
Renovate Bot
80def1bdcb chore(deps): update dependency conventional-changelog to v3.1.24 2020-11-05 02:50:44 +00:00
Renovate Bot
82bced50fb chore(deps): update babel monorepo 2020-11-04 12:09:26 +00:00
Renovate Bot
d2defa5431 chore(deps): update dependency @nestjs/schematics to v7.2.1 2020-11-04 11:30:13 +00:00
Kamil Mysliwiec
8e216b2b25 Merge pull request #5545 from nestjs/renovate/amqplib-0.x
chore(deps): update dependency @types/amqplib to v0.5.15
2020-11-04 09:48:10 +01:00
Kamil Mysliwiec
fad05c81b0 Merge pull request #5662 from nestjs/renovate/nestjs-schematics-7.x
chore(deps): update dependency @nestjs/schematics to v7.1.3
2020-11-04 09:47:28 +01:00
Renovate Bot
74e0f26d19 chore(deps): update dependency @nestjs/schematics to v7.1.3 2020-11-03 13:17:52 +00:00
Renovate Bot
13d5cd8c53 chore(deps): update dependency @types/amqplib to v0.5.15 2020-11-03 09:00:06 +00:00
Kamil Mysliwiec
7a9fd4f473 Merge pull request #5641 from nestjs/renovate/multer-1.x
chore(deps): update dependency @types/multer to v1.4.4
2020-11-03 08:56:47 +01:00
Kamil Mysliwiec
dcaffac240 Merge pull request #5644 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v26.6.2
2020-11-03 08:56:27 +01:00
Kamil Mysliwiec
3eeb3b899b Merge pull request #5649 from nestjs/renovate/webpack-5.x
chore(deps): update dependency webpack to v5.3.2
2020-11-03 08:55:59 +01:00
Kamil Mysliwiec
535c4a7acf Merge pull request #5650 from nestjs/renovate/docker-mysql-5.x
chore(deps): update mysql docker tag to v5.7.32
2020-11-03 08:55:53 +01:00
Kamil Mysliwiec
7cb50cbcfd Merge pull request #5656 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.19.0
2020-11-03 08:55:37 +01:00
Kamil Mysliwiec
b00df2d884 Merge pull request #5658 from nestjs/renovate/bull-3.x
fix(deps): update dependency bull to v3.18.1
2020-11-03 08:55:21 +01:00
Renovate Bot
2255d9a1b9 fix(deps): update dependency bull to v3.18.1 2020-11-03 01:53:37 +00:00
Renovate Bot
ca96f9110b fix(deps): update dependency axios to v0.21.0 2020-11-03 00:32:21 +00:00
Renovate Bot
d7875e3051 fix(deps): update apollo graphql packages to v2.19.0 2020-11-03 00:03:55 +00:00
Renovate Bot
fa07630098 chore(deps): update dependency mocha to v8.2.1 2020-11-02 23:54:02 +00:00
Renovate Bot
351694cf8c chore(deps): update mysql docker tag to v5.7.32 2020-11-02 19:54:47 +00:00
Renovate Bot
034d6d69e7 chore(deps): update dependency webpack to v5.3.2 2020-11-02 19:54:35 +00:00
Renovate Bot
96e7064fcd chore(deps): update dependency sinon to v9.2.1 2020-11-02 18:21:07 +00:00
Renovate Bot
292aa33c44 chore(deps): update dependency lint-staged to v10.5.1 2020-11-02 17:55:23 +00:00
Renovate Bot
77fbc5a511 chore(deps): update dependency jest to v26.6.2 2020-11-02 16:39:25 +00:00
Renovate Bot
f60fc95066 chore(deps): update dependency engine.io-client to v4 2020-11-02 15:59:46 +00:00
Renovate Bot
3e07d44287 chore(deps): update dependency fastify-multipart to v3.3.0 2020-11-02 15:56:04 +00:00
Kamil Myśliwiec
df360d9365 chore(@nestjs) publish v7.5.1 release 2020-11-02 14:15:35 +01:00
Kamil Myśliwiec
be4e50f144 fix(platform-fastify): fix register method signature types 2020-11-02 14:04:18 +01:00
Kamil Myśliwiec
6f5ef692fa ci(): temporarily switch to npm i instead of ci to fix the build 2020-11-02 13:12:18 +01:00
Kamil Myśliwiec
054c6e9817 chore(@nestjs) publish v7.5.0 release 2020-11-02 12:48:13 +01:00
Kamil Myśliwiec
a166b08441 ci(): remove prefer offline flag from samples build script 2020-11-02 12:04:49 +01:00
Kamil Myśliwiec
2d732c8b0c ci(): add no-optional flag to samples install script 2020-11-02 11:54:31 +01:00
Kamil Myśliwiec
a08deb63cd fix(platform-fastify): fix typing issues 2020-11-02 11:32:19 +01:00
Renovate Bot
d2984ca3bf chore(deps): update dependency @types/multer to v1.4.4 2020-11-02 10:18:27 +00:00
Kamil Myśliwiec
8e4e9b7edd Merge branch 'master' of https://github.com/nestjs/nest 2020-11-02 11:09:37 +01:00
Kamil Myśliwiec
df3f906b80 Merge branch 'renovate/fastify-3.x' 2020-11-02 11:09:31 +01:00
Kamil Myśliwiec
24b32e3930 refactor(): run format script (prettier) 2020-11-02 11:09:11 +01:00
Kamil Myśliwiec
4565a9fd99 fix(platform-fastify): fix inject and use method usage 2020-11-02 11:09:01 +01:00
Kamil Myśliwiec
03f500d867 chore(): resolve merge conflicts 2020-11-02 10:59:39 +01:00
Kamil Mysliwiec
739878bd35 Merge pull request #5627 from smhmayboudi/5599-fix-kafkaserver-constructor
fix(microservice): Fix KafkaServer constructor
2020-11-02 10:57:58 +01:00
Kamil Myśliwiec
009d99908b Merge branch 'smhmayboudi-5603-feat-kafkaclient-kafkaserver-naming-conventions' 2020-11-02 10:57:36 +01:00
Kamil Myśliwiec
81550648b3 Merge branch 'master' of https://github.com/nestjs/nest; branch '5603-feat-kafkaclient-kafkaserver-naming-conventions' of https://github.com/smhmayboudi/nest into smhmayboudi-5603-feat-kafkaclient-kafkaserver-naming-conventions 2020-11-02 10:57:00 +01:00
Kamil Myśliwiec
5128867bba Merge branch 'smhmayboudi-5629-feat-KafkaConfig-brokers' 2020-11-02 10:51:50 +01:00
Kamil Myśliwiec
b8c6373258 chore(): resolve merge conflicts 2020-11-02 10:51:36 +01:00
Kamil Mysliwiec
bef63a7c74 Merge pull request #5524 from jmcdo29/feat/file-upload-sample
test(file-upload): creates an example and test for file uploading
2020-11-02 10:48:24 +01:00
Kamil Mysliwiec
e0cb9e05ec Merge pull request #5523 from jmcdo29/feat/jwt-unit-tests
test(jwt-sample): adds tests to the jwt to show e2e flow works
2020-11-02 10:47:26 +01:00
Kamil Mysliwiec
eb80c5878e Update sample/19-auth-jwt/e2e/app/app.e2e-spec.ts 2020-11-02 10:47:13 +01:00
Kamil Myśliwiec
8a03dc6947 Merge branch 'mehdi-sh-hm-conditional-cache-ttl-feature' 2020-11-02 10:46:09 +01:00
Kamil Myśliwiec
e656b17039 refactor(common): remove unnecessary type arg from ttl factory 2020-11-02 10:45:55 +01:00
Kamil Myśliwiec
3ba9b2761c chore(): resolve merge conflicts 2020-11-02 10:43:47 +01:00
Kamil Myśliwiec
7782b27e1a Merge branch 'OpportunityLiu-patch-1' 2020-11-02 10:40:31 +01:00
Kamil Myśliwiec
2344e72418 fix(core): when serializing dynamic module metadata, hash stringified arrow funcs 2020-11-02 10:40:20 +01:00
Kamil Myśliwiec
2f1e4701f6 Merge branch 'patch-1' of https://github.com/OpportunityLiu/nest into OpportunityLiu-patch-1 2020-11-02 10:33:33 +01:00
Kamil Mysliwiec
01345a75ed Merge pull request #5628 from squareloop1/fix/add-missing-chaining-api
fix(platform-fastify): adds missing chaining API types for LightMyRequest inject()
2020-11-02 10:09:18 +01:00
Kamil Mysliwiec
873599b7e5 Merge pull request #5295 from Nosfistis/bugfix/unit-test-pattern
fix(test): stricten unit test file pattern
2020-11-02 10:03:50 +01:00
Kamil Mysliwiec
0ec42bd482 Merge pull request #5609 from capaio/rmq-url-acceptable-types
feature(microservices): update acceptable types in RabbitMq urls
2020-11-02 09:58:56 +01:00
Kamil Mysliwiec
62352ac7e2 Merge pull request #5638 from smhmayboudi/5637-feat-improve-KafkaHeaders
feat(microservices): Improve KafkaHeaders
2020-11-02 09:57:42 +01:00
Kamil Mysliwiec
b4b7e3abe3 Merge pull request #5624 from nestjs/renovate/ws-7.x
chore(deps): update dependency @types/ws to v7.2.9
2020-11-02 09:53:13 +01:00
Hossein Mayboudi
8d9153402e feat(microservices): Improve KafkaHeaders
Issue  Number: #5637
2020-10-30 22:05:44 +03:30
Hossein Mayboudi
0af826e2d4 feat(microservices): Add BrokersFunction to KafkaConfig brokers property
Issue Number: #5629
2020-10-30 19:36:53 +03:30
Jay McDoniel
9d071cfcd0 fix: add types to upload sample 2020-10-30 09:02:24 -07:00
Renovate Bot
8da9342363 chore(deps): update dependency @types/ws to v7.2.9 2020-10-30 15:24:02 +00:00
Kamil Myśliwiec
304b1c81ac Merge branch 'soyuka-feat/eventsource' 2020-10-30 14:57:25 +01:00
Kamil Myśliwiec
945d608df2 sample(): update sse sample 2020-10-30 14:57:13 +01:00
Kamil Myśliwiec
320b599503 test(core): fix router execution context tests 2020-10-30 14:54:58 +01:00
Kamil Myśliwiec
9ba45d6efb fix(core): fix invalid is object import 2020-10-30 14:50:58 +01:00
Kamil Myśliwiec
511625c35e refactor(core): align code changes to the rest of the codebase 2020-10-30 14:49:07 +01:00
Kamil Myśliwiec
e22a3e7c53 Merge branch 'mikicho-Michael/fix-expectedType-override' 2020-10-30 14:10:42 +01:00
Kamil Myśliwiec
e8b2761278 refactor(common): move expected type check (validation pipe) to the top 2020-10-30 14:10:29 +01:00
Kamil Myśliwiec
88cf4c1926 Merge branch 'Michael/fix-expectedType-override' of https://github.com/mikicho/nest into mikicho-Michael/fix-expectedType-override 2020-10-30 14:05:53 +01:00
Kamil Mysliwiec
0d7b13ec53 Merge pull request #5143 from AlexDaSoul/grpc-send-metadata
feat(microservices): Add grpc metadata to server responce
2020-10-30 14:05:35 +01:00
Kamil Myśliwiec
1c32066b80 chore(): bump axios to 0.21.0 2020-10-30 13:01:24 +01:00
Kamil Mysliwiec
5e3c88a2a6 Merge pull request #5630 from nestjs/feat/remove-cli-color
feat(common): remove cli-color dependency
2020-10-30 12:12:42 +01:00
Patrick Münd
b63e279212 fix(platform-fastify): Remove redundant type assertion 2020-10-30 10:09:04 +01:00
Kamil Myśliwiec
b8a52cccaf feat(common): remove cli-color dependency 2020-10-30 10:04:20 +01:00
ccappai
1655e963a5 change type order 2020-10-30 09:39:42 +01:00
Hossein Mayboudi
1ff912e693 feat(microservice): Add clientIdPostfix to KafkaConfig
Issue Number: #5603
2020-10-30 12:04:08 +03:30
Patrick Münd
764859e93a fix(platform-fastify): adds missing chaining API types for LightMyRequest inject() 2020-10-30 09:28:30 +01:00
ccappai
f96470b4ec run format script 2020-10-30 09:16:48 +01:00
Kamil Mysliwiec
ad27807e12 Update packages/microservices/client/client-rmq.ts 2020-10-30 09:05:14 +01:00
Kamil Mysliwiec
5b3c664c8c Update packages/microservices/interfaces/microservice-configuration.interface.ts 2020-10-30 09:04:51 +01:00
Kamil Mysliwiec
5fc57bd3f2 Update packages/microservices/server/server-rmq.ts 2020-10-30 09:04:37 +01:00
Hossein Mayboudi
5b8d765903 fix(microservice): Fix KafkaServer constructor
Issue Number: #5599
2020-10-30 11:20:05 +03:30
Michael Solomon
e40a83fbe5 fix 2020-10-29 21:03:18 +02:00
Michael Solomon
c7b6eba2f1 fix 2020-10-29 20:03:00 +02:00
Jay McDoniel
fca4aceb8b fix: address pr comments 2020-10-29 07:01:26 -07:00
Kamil Mysliwiec
da13cca8cd Merge pull request #5625 from nestjs/princechauhan1992-added-abort-on-error-in-nestapplication-context-options
Princechauhan1992 added abort on error in nestapplication context options
2020-10-29 14:30:24 +01:00
Kamil Mysliwiec
c34d08dbfe Merge pull request #5327 from princechauhan1992/added-abort-on-error-in-nestapplication-context-options
feat(core): Add abortOnError option in NestApplicationContextOptions
2020-10-29 14:22:33 +01:00
Kamil Myśliwiec
437955f68d refactor(): move rethrow to a dedicated file, run format 2020-10-29 14:21:32 +01:00
Kamil Myśliwiec
6bb6eba781 Merge branch 'added-abort-on-error-in-nestapplication-context-options' of https://github.com/princechauhan1992/nest into princechauhan1992-added-abort-on-error-in-nestapplication-context-options 2020-10-29 14:01:42 +01:00
Kamil Mysliwiec
e270c6ada2 Update packages/common/interfaces/nest-application-context-options.interface.ts 2020-10-29 14:00:51 +01:00
Kamil Mysliwiec
68a0abacbf Update packages/common/interfaces/nest-application-context-options.interface.ts 2020-10-29 14:00:32 +01:00
Kamil Mysliwiec
b36ef52219 Merge pull request #5422 from willsoto/fix/kafka-microservice
fix(microservice/kafka): properly await disconnect promises
2020-10-29 13:55:22 +01:00
Kamil Mysliwiec
a13eb17fd9 Merge pull request #5570 from nestjs/renovate/nodemon-2.x
chore(deps): update dependency nodemon to v2.0.6
2020-10-29 13:54:12 +01:00
Kamil Mysliwiec
255da6b8b0 Merge branch 'master' into renovate/nodemon-2.x 2020-10-29 13:54:05 +01:00
Kamil Mysliwiec
1cfc5ce5c1 Merge pull request #5485 from kiwikern/logger-log-level-types
fix(core): allow setting log level after app creation
2020-10-29 13:53:09 +01:00
Kamil Mysliwiec
f9930ca1cf Merge pull request #5443 from mkaufmaner/5442-update-kafka-interface
feat(microservices): Updates Kafka options interface
2020-10-29 13:52:33 +01:00
Kamil Mysliwiec
0f3bbeca73 Merge pull request #5494 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v4.5.0
2020-10-29 13:51:20 +01:00
Kamil Mysliwiec
7bf900abe4 Merge pull request #5498 from kkoomen/feature/validation-pipe
feat(validation pipe): use protected methods instead of private
2020-10-29 13:51:07 +01:00
Kamil Mysliwiec
ed62048d0f Merge pull request #5530 from borovik96/issue-4874
bugfix(microservices/nats): check replyTo channel existence
2020-10-29 13:50:32 +01:00
Kamil Mysliwiec
8caf6d7853 Update packages/microservices/server/server-nats.ts 2020-10-29 13:49:46 +01:00
Kamil Mysliwiec
f0cd1cec49 Merge pull request #5547 from jmcdo29/feat/validation-pipe-protected-methods
feat(common): gives validation pipe protected package loads
2020-10-29 13:46:28 +01:00
Kamil Mysliwiec
1f7cf0bcfb Merge pull request #5571 from bcldvd/feature/misdirected-exceptions
feat(common-exceptions): Add Misdirected exception and status code enum
2020-10-29 13:46:00 +01:00
Kamil Mysliwiec
486cdb5cf7 Merge pull request #5597 from itsa-sh/persistent-messages
feature(microservices): Add persistent property to RmqOptions
2020-10-29 13:45:39 +01:00
Kamil Mysliwiec
3156f74a9b Merge pull request #5623 from nestjs/fix/async-middleware-order
fix(core): fix request scoped middleware execution order #5612
2020-10-29 13:45:13 +01:00
Kamil Mysliwiec
858179d13b Merge pull request #5622 from nestjs/renovate/jest-26.x
chore(deps): update dependency @types/jest to v26.0.15
2020-10-29 13:38:16 +01:00
Kamil Myśliwiec
001eff418c fix(core): fix request scoped middleware execution order #5612 2020-10-29 12:56:49 +01:00
Kamil Mysliwiec
82203beb64 Merge pull request #5620 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo
2020-10-29 12:53:14 +01:00
Kamil Mysliwiec
5e827738d3 Merge pull request #5621 from nestjs/renovate/chai-4.x
chore(deps): update dependency @types/chai to v4.2.14
2020-10-29 12:43:42 +01:00
Renovate Bot
aaa60acfc0 chore(deps): update dependency @types/jest to v26.0.15 2020-10-29 10:47:16 +00:00
Renovate Bot
6645715f38 chore(deps): update dependency @types/chai to v4.2.14 2020-10-29 09:53:21 +00:00
Renovate Bot
9cab885939 chore(deps): update babel monorepo 2020-10-29 09:44:16 +00:00
Kamil Mysliwiec
a3446a5134 Merge pull request #5565 from nestjs/renovate/ts-loader-8.x
chore(deps): update dependency ts-loader to v8.0.7
2020-10-29 10:34:41 +01:00
ccappai
f51b8f820b feature(microservices): update acceptable types in RabbitMq options 2020-10-29 10:28:24 +01:00
Kamil Mysliwiec
53f44f5062 Merge pull request #5549 from nestjs/renovate/fast-json-stringify-2.x
fix(deps): update dependency fast-json-stringify to v2.2.9
2020-10-29 10:03:09 +01:00
Kamil Mysliwiec
275fb49285 Merge pull request #5550 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.10
2020-10-29 10:03:02 +01:00
Kamil Mysliwiec
02e5ace296 Merge pull request #5556 from nestjs/renovate/cors-2.x
chore(deps): update dependency @types/cors to v2.8.8
2020-10-29 10:02:17 +01:00
Kamil Mysliwiec
504aeadd26 Merge pull request #5562 from nestjs/renovate/ts-morph-8.x
chore(deps): update dependency ts-morph to v8.1.2
2020-10-29 10:01:46 +01:00
Kamil Mysliwiec
59a5f550c5 Merge pull request #5546 from nestjs/renovate/bull-3.x
chore(deps): update dependency @types/bull to v3.14.4
2020-10-29 10:00:49 +01:00
Kamil Mysliwiec
579e2d416f Merge pull request #5567 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.28
2020-10-29 10:00:34 +01:00
Kamil Mysliwiec
784746dcaf Merge pull request #5559 from nestjs/renovate/webpack-5.x
chore(deps): update dependency webpack to v5
2020-10-29 10:00:15 +01:00
Kamil Mysliwiec
e5d29c4c6f Merge pull request #5534 from nestjs/renovate/light-my-request-4.x
fix(deps): update dependency light-my-request to v4.2.1
2020-10-29 10:00:10 +01:00
Kamil Mysliwiec
d53c3adf99 Merge pull request #5535 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v26.6.1
2020-10-29 09:59:56 +01:00
Kamil Mysliwiec
c2373e13e5 Merge pull request #5537 from nestjs/renovate/tslib-2.x
fix(deps): update dependency tslib to v2.0.3
2020-10-29 09:59:42 +01:00
Kamil Mysliwiec
fbe19eaa25 Merge pull request #5540 from nestjs/renovate/imports-loader-1.x
chore(deps): update dependency imports-loader to v1.2.0
2020-10-29 09:59:25 +01:00
Kamil Mysliwiec
b2ff5fd6bc Merge pull request #5538 from nestjs/renovate/sinon-9.x
chore(deps): update dependency sinon to v9.2.0
2020-10-29 09:59:08 +01:00
Hyuni
47f4e2ec10 Merge pull request #1 from nestjs/master
sync from nest
2020-10-28 16:48:04 +08:00
Kamil Mysliwiec
d33f4a6bc7 Merge pull request #5583 from kaznovac/patch-4
refactor(microservices): typo deffered -> deferred
2020-10-27 12:33:13 +01:00
Kamil Mysliwiec
ee585b3e88 Merge pull request #5581 from glenwinters/use-guards-test-wording
test: fix guard decorator test names
2020-10-27 12:32:07 +01:00
Kamil Mysliwiec
727f3134de Merge pull request #5580 from kaznovac/patch-3
test(microservices): fix typo Deffered -> Deferred
2020-10-27 12:31:28 +01:00
ccappai
b8c479ebe5 feature(microservices): update acceptable types in RabbitMq urls 2020-10-26 11:38:20 +01:00
Michael Solomon
dbcc366227 fix(common): expectedType get overriden by metatype 2020-10-25 18:55:59 +02:00
Renovate Bot
cf81ae7bc9 chore(deps): update dependency ts-loader to v8.0.7 2020-10-24 12:03:08 +00:00
Renovate Bot
1a9f1c9ee4 fix(deps): update dependency mongoose to v5.10.10 2020-10-23 18:21:21 +00:00
Renovate Bot
8c5904a7e6 chore(deps): update dependency jest to v26.6.1 2020-10-23 10:00:30 +00:00
Ashley Meadows
491d1934ad chore(microservices): Add persistent property to RmqOptions
Adding the persistent property to RmqOptions so messages do not get lost should the RabbitMQ broker restart.
2020-10-22 21:25:11 +01:00
Renovate Bot
227087bb5a chore(deps): update dependency webpack to v5 2020-10-22 17:13:42 +00:00
Renovate Bot
3778752392 fix(deps): update dependency light-my-request to v4.2.1 2020-10-20 08:43:42 +00:00
Renovate Bot
ed99cc664e chore(deps): update dependency nodemon to v2.0.6 2020-10-19 18:53:55 +00:00
Renovate Bot
6de9092a84 chore(deps): update typescript-eslint monorepo to v4.5.0 2020-10-19 18:05:17 +00:00
Renovate Bot
ca0a6abd18 fix(deps): update dependency fastify to v3.7.0 2020-10-19 16:47:47 +00:00
Marko Kaznovac
d0aef45690 refactor(microservices): typo deffered -> deferred 2020-10-19 10:57:32 +02:00
Glen Winters
3ba857f28c test: fix guard decorator test names 2020-10-19 00:34:14 -05:00
Marko Kaznovac
53fe9a2afe test(microservices): fix typo Deffered -> Deferred
fix typo in test
2020-10-18 18:48:52 +02:00
Renovate Bot
9a0b096a6b fix(deps): update dependency fast-json-stringify to v2.2.9 2020-10-14 15:59:19 +00:00
David
33d41bd2c4 feat(common-exceptions): Add Misdirected exception and status code enum 2020-10-14 17:10:05 +02:00
Renovate Bot
b2d08d6295 chore(deps): update dependency @types/redis to v2.8.28 2020-10-13 14:57:53 +00:00
soyuka
7850c9ab70 fix(sse): Drain stream as recommended 2020-10-13 11:45:55 +02:00
soyuka
e0e1febf5f test(sse): Test sse 2020-10-13 11:45:54 +02:00
soyuka
98c3c9859a feat(sse): Implement Server-Sent Events
See discussion in #4826
2020-10-13 11:43:30 +02:00
Renovate Bot
93d29c7847 chore(deps): update dependency ts-morph to v8.1.2 2020-10-12 14:32:04 +00:00
Renovate Bot
d89554a842 chore(deps): update dependency @types/cors to v2.8.8 2020-10-12 01:16:49 +00:00
Renovate Bot
ae5ddbc400 fix(deps): update dependency tslib to v2.0.3 2020-10-10 00:12:44 +00:00
Jay McDoniel
4355bcac0c feat(common): gives validation pipe protected package loads
By having the `loadPackage` for `class-validator` and
`class-transformer` under `protected` methods, other devs can now
decide if they want to use different validation packages, like
`class-validator-multi-lang` but by default will still use the standard
`class-validator` and `class-transformer`.

fix #5542
2020-10-08 22:09:13 -07:00
Renovate Bot
3bb12041e0 chore(deps): update dependency @types/bull to v3.14.4 2020-10-08 20:33:12 +00:00
Renovate Bot
544c2997c5 chore(deps): update dependency imports-loader to v1.2.0 2020-10-07 14:19:19 +00:00
Renovate Bot
a633f27bf3 chore(deps): update dependency sinon to v9.2.0 2020-10-06 19:19:48 +00:00
Kamil Mysliwiec
513080d8f7 Merge pull request #5529 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v26.5.0
2020-10-06 08:55:37 +02:00
Kamil Mysliwiec
948226eba7 Merge pull request #5531 from nestjs/renovate/chai-4.x
chore(deps): update dependency @types/chai to v4.2.13
2020-10-06 08:55:30 +02:00
Kamil Mysliwiec
f497e574cf Merge pull request #5533 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.8
2020-10-06 08:55:00 +02:00
Kamil Mysliwiec
ce8039a2e1 Merge pull request #5532 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.18.2
2020-10-06 08:52:34 +02:00
Renovate Bot
f41e5f4588 fix(deps): update dependency mongoose to v5.10.8 2020-10-05 21:52:00 +00:00
Renovate Bot
87b6513ded fix(deps): update apollo graphql packages to v2.18.2 2020-10-05 19:23:13 +00:00
Vladimir Borovik
4d7c2651dc fix(microservices/nats): Check replyTo channel existence 2020-10-05 20:36:49 +03:00
Renovate Bot
3d25c24cb9 chore(deps): update dependency @types/chai to v4.2.13 2020-10-05 16:06:09 +00:00
Renovate Bot
76ad06bced chore(deps): update dependency jest to v26.5.0 2020-10-05 11:40:44 +00:00
Kamil Mysliwiec
a7a427def7 Merge pull request #5473 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.18.1
2020-10-05 11:45:56 +02:00
Kamil Mysliwiec
38512b5db0 Merge pull request #5504 from nestjs/renovate/typeorm-0.x
fix(deps): update dependency typeorm to v0.2.28
2020-10-05 11:30:13 +02:00
Kamil Mysliwiec
25bde97900 Merge pull request #5503 from nestjs/renovate/sinon-9.x
chore(deps): update dependency sinon to v9.1.0
2020-10-05 11:21:55 +02:00
Kamil Mysliwiec
0055eb97cf Merge pull request #5495 from nestjs/renovate/ws-7.x
chore(deps): update dependency @types/ws to v7.2.7
2020-10-05 10:56:00 +02:00
Kamil Mysliwiec
99be2f16b7 Merge pull request #5500 from nestjs/renovate/ts-jest-26.x
chore(deps): update dependency ts-jest to v26.4.1
2020-10-05 10:55:35 +02:00
Kamil Mysliwiec
667c742e72 Merge pull request #5506 from nestjs/renovate/bull-3.x
chore(deps): update dependency @types/bull to v3.14.3
2020-10-05 10:55:15 +02:00
Kamil Mysliwiec
f4be8d034b Merge pull request #5509 from nestjs/renovate/fastify-3.x
fix(deps): update dependency fastify to v3.5.1
2020-10-05 10:55:03 +02:00
Kamil Mysliwiec
e562440988 Merge pull request #5508 from nestjs/renovate/graphql-tools-monorepo
fix(deps): update dependency graphql-tools to v6.2.4
2020-10-05 10:54:53 +02:00
Kamil Mysliwiec
a3896e433e Merge pull request #5512 from nestjs/renovate/docker-confluentinc-cp-zookeeper-5.x
chore(deps): update confluentinc/cp-zookeeper docker tag to v5.5.2
2020-10-05 10:54:22 +02:00
Kamil Mysliwiec
62bccbbe86 Merge pull request #5510 from nestjs/renovate/socket.io-packages
chore(deps): update dependency socket.io-client to v2.3.1
2020-10-05 10:54:15 +02:00
Kamil Mysliwiec
04a4f7aa96 Merge pull request #5511 from nestjs/renovate/docker-confluentinc-cp-kafka-5.x
chore(deps): update confluentinc/cp-kafka docker tag to v5.5.2
2020-10-05 10:54:08 +02:00
Kamil Mysliwiec
ba807c9a19 Merge pull request #5515 from mvegter/docs/typo
fix(docs): corrected spelling mistake in JSDoc
2020-10-05 10:53:59 +02:00
Kamil Mysliwiec
59996b9703 Merge pull request #5518 from nestjs/renovate/light-my-request-4.x
fix(deps): update dependency light-my-request to v4.1.0
2020-10-05 10:53:40 +02:00
Kamil Mysliwiec
12e5af85ad Merge pull request #5527 from nestjs/renovate/fastify-static-3.x
fix(deps): update dependency fastify-static to v3.2.1
2020-10-05 10:53:04 +02:00
Kamil Mysliwiec
9316e5a168 Merge pull request #5528 from nestjs/renovate/uuid-8.x
fix(deps): update dependency uuid to v8.3.1
2020-10-05 10:52:51 +02:00
Renovate Bot
d80deb2caf fix(deps): update dependency uuid to v8.3.1 2020-10-05 01:26:15 +00:00
Renovate Bot
a70632ebe1 fix(deps): update dependency fastify-static to v3.2.1 2020-10-05 01:24:16 +00:00
Renovate Bot
5a2893b845 chore(deps): update dependency sinon to v9.1.0 2020-10-04 22:02:26 +00:00
Renovate Bot
8719277226 fix(deps): update dependency fastify to v3.5.1 2020-10-04 11:25:12 +00:00
Jay McDoniel
854b1db006 test(file-upload): creates an example and test for file uploading 2020-10-03 14:21:43 -07:00
Jay McDoniel
6266e1995a fix(sample): fix testing failurefrom chai import 2020-10-03 12:05:00 -07:00
Jay McDoniel
5a8909bfdb test(jwt-sample): adds tests to the jwt to show e2e flow works 2020-10-03 11:34:36 -07:00
Renovate Bot
fbd354fb86 fix(deps): update dependency light-my-request to v4.1.0 2020-10-01 21:50:16 +00:00
Martijn Vegter
4bc2b46d1e fix(docs): corrected spelling mistake in JSDoc 2020-10-01 09:33:16 +02:00
Renovate Bot
4685e985d7 chore(deps): update confluentinc/cp-zookeeper docker tag to v5.5.2 2020-09-30 19:56:39 +00:00
Renovate Bot
a6a5e58fae chore(deps): update confluentinc/cp-kafka docker tag to v5.5.2 2020-09-30 19:56:26 +00:00
Renovate Bot
e63ea9d91c chore(deps): update dependency socket.io-client to v2.3.1 2020-09-30 16:40:40 +00:00
Renovate Bot
37ce272fcb fix(deps): update dependency typeorm to v0.2.28 2020-09-30 14:33:36 +00:00
Renovate Bot
91f8207718 fix(deps): update dependency graphql-tools to v6.2.4 2020-09-30 07:42:48 +00:00
Renovate Bot
5d6c74a02d chore(deps): update dependency @types/bull to v3.14.3 2020-09-30 03:12:29 +00:00
Renovate Bot
f6bffc445d chore(deps): update dependency ts-jest to v26.4.1 2020-09-29 11:03:13 +00:00
Kamil Mysliwiec
1450eb490a Merge pull request #5496 from nestjs/renovate/gulp-4.x
chore(deps): update dependency @types/gulp to v4.0.7
2020-09-29 08:26:16 +02:00
Renovate Bot
d5b75ad102 chore(deps): update dependency @types/gulp to v4.0.7 2020-09-29 02:52:33 +00:00
Kim 金可明
e2a157725c feat(validation pipe): use protected methods instead of private 2020-09-29 10:47:45 +08:00
Renovate Bot
f8dfcf788a chore(deps): update dependency @types/ws to v7.2.7 2020-09-28 23:03:34 +00:00
Kamil Mysliwiec
ab9d3ef6fb Merge pull request #5489 from nestjs/renovate/eslint-7.x
chore(deps): update dependency eslint to v7.10.0
2020-09-28 09:07:04 +02:00
Kamil Mysliwiec
3dd487030f Merge pull request #5488 from nestjs/renovate/sinon-9.x
chore(deps): update dependency @types/sinon to v9.0.6
2020-09-28 09:06:32 +02:00
Kamil Mysliwiec
80a43751fa Merge pull request #5476 from nestjs/renovate/supertest-5.x
chore(deps): update dependency supertest to v5
2020-09-28 09:02:53 +02:00
Kamil Mysliwiec
4493bf07da Merge pull request #5474 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.7
2020-09-28 09:02:39 +02:00
Kamil Mysliwiec
376fff2a60 Merge pull request #5471 from nestjs/renovate/point-of-view-4.x
fix(deps): update dependency point-of-view to v4.6.0
2020-09-28 09:02:22 +02:00
Kamil Mysliwiec
42f8c6aee1 Merge pull request #5490 from nestjs/renovate/eslint-plugin-import-2.x
chore(deps): update dependency eslint-plugin-import to v2.22.1
2020-09-28 09:02:04 +02:00
Renovate Bot
668a02726a chore(deps): update dependency eslint-plugin-import to v2.22.1 2020-09-28 02:19:01 +00:00
Renovate Bot
20dcade8f2 chore(deps): update dependency eslint to v7.10.0 2020-09-28 00:46:49 +00:00
Renovate Bot
74bec8ebb0 chore(deps): update dependency @types/sinon to v9.0.6 2020-09-28 00:20:49 +00:00
Kim Kern
69ada75280 fix(core): allow setting log level after app creation
So far, they types only allowed to set the log level within the application options, and not when calling app.useLogger(), although internally, they call the same method.
closes @nestjs/nest#5484
2020-09-27 20:27:06 +02:00
Renovate Bot
2253c19243 chore(deps): update dependency supertest to v5 2020-09-25 14:02:20 +00:00
Renovate Bot
c39d4ca4dd fix(deps): update dependency mongoose to v5.10.7 2020-09-24 21:33:02 +00:00
Renovate Bot
e3743e4d54 fix(deps): update apollo graphql packages to v2.18.1 2020-09-24 19:22:39 +00:00
Renovate Bot
fdca922ef3 fix(deps): update dependency point-of-view to v4.6.0 2020-09-24 16:05:23 +00:00
Will
4f96edfaa7 fix(microservice/kafka): properly await disconnect promises
`producer.disconnect()` and `consumer.disconnect()` are promises.
Since they weren't being `await`ed properly, you would have Kafka code that
would attempt to execute after teardown. By waiting for the promises, those errors
go away.

Official documentation: https://kafka.js.org/docs/getting-started

Closes #4830
2020-09-24 08:11:24 -04:00
Kamil Mysliwiec
09fbc83108 Merge pull request #5468 from nestjs/renovate/nestjs-schedule-0.x
fix(deps): update dependency @nestjs/schedule to v0.4.1
2020-09-23 14:46:01 +02:00
Renovate Bot
f60f8d39e5 fix(deps): update dependency @nestjs/schedule to v0.4.1 2020-09-23 12:13:34 +00:00
Kamil Mysliwiec
ac070b80f9 Merge pull request #5463 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.18.0
2020-09-22 09:37:31 +02:00
Kamil Mysliwiec
965667a771 Merge pull request #5461 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v4.2.0
2020-09-22 08:19:19 +02:00
Kamil Mysliwiec
04b0659ab1 Merge pull request #5456 from nestjs/renovate/nestjs-bull-0.x
fix(deps): update dependency @nestjs/bull to v0.2.2
2020-09-22 08:15:51 +02:00
Kamil Mysliwiec
1fb3efd979 Merge pull request #5458 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.7.0
2020-09-22 08:14:46 +02:00
Kamil Mysliwiec
bca5c43502 Merge pull request #5459 from nestjs/renovate/mysql2-2.x
fix(deps): update dependency mysql2 to v2.2.5
2020-09-22 08:14:37 +02:00
Renovate Bot
9d20096d71 fix(deps): update apollo graphql packages to v2.18.0 2020-09-22 05:36:41 +00:00
Renovate Bot
70b17a1c73 chore(deps): update typescript-eslint monorepo to v4.2.0 2020-09-21 17:50:23 +00:00
Renovate Bot
4a8a066b65 fix(deps): update dependency mysql2 to v2.2.5 2020-09-21 12:32:54 +00:00
Kamil Myśliwiec
e8cf9fc248 sample(): update swagger and graphql code first samples 2020-09-21 13:30:50 +02:00
Renovate Bot
5c8809cd88 fix(deps): update dependency @nestjs/graphql to v7.7.0 2020-09-21 11:28:58 +00:00
Renovate Bot
0d5c766684 fix(deps): update dependency @nestjs/bull to v0.2.2 2020-09-21 10:46:43 +00:00
Kamil Mysliwiec
2879dc689b Merge pull request #5420 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v4.1.1
2020-09-21 12:33:46 +02:00
Kamil Mysliwiec
b3d5249ded Merge pull request #5450 from nestjs/renovate/ts-jest-26.x
chore(deps): update dependency ts-jest to v26.4.0
2020-09-21 12:30:05 +02:00
Kamil Mysliwiec
b8a0a3066e Merge pull request #5446 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.6
2020-09-21 12:29:55 +02:00
Kamil Mysliwiec
32e5aa4d5a Merge pull request #5432 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.4.0
2020-09-21 12:29:45 +02:00
Renovate Bot
f315f05a2a chore(deps): update dependency ts-jest to v26.4.0 2020-09-21 10:09:14 +00:00
Renovate Bot
7a130b07e5 chore(deps): update dependency lint-staged to v10.4.0 2020-09-21 08:37:51 +00:00
Renovate Bot
20f0106efa fix(deps): update dependency mongoose to v5.10.6 2020-09-21 08:32:22 +00:00
Kamil Mysliwiec
cdae4b3aae Merge pull request #5441 from nestjs/renovate/fast-json-stringify-2.x
fix(deps): update dependency fast-json-stringify to v2.2.7
2020-09-21 10:08:00 +02:00
Kamil Mysliwiec
e3aac1d546 Merge pull request #5445 from nestjs/renovate/typescript-4.x
chore(deps): update dependency typescript to v4.0.3
2020-09-21 10:07:37 +02:00
Kamil Mysliwiec
cc374e705f Merge pull request #5451 from nestjs/renovate/ts-loader-8.x
chore(deps): update dependency ts-loader to v8.0.4
2020-09-21 10:07:21 +02:00
Kamil Mysliwiec
2fb28d077e Merge pull request #5452 from nestjs/renovate/ts-morph-8.x
chore(deps): update dependency ts-morph to v8.1.1
2020-09-21 10:07:16 +02:00
Kamil Mysliwiec
e90bebfb84 Merge pull request #5453 from nestjs/renovate/graphql-tools-monorepo
fix(deps): update dependency graphql-tools to v6.2.3
2020-09-21 10:07:10 +02:00
Kamil Mysliwiec
457b8488ca Merge pull request #5454 from nestjs/renovate/mysql2-2.x
fix(deps): update dependency mysql2 to v2.2.3
2020-09-21 10:06:47 +02:00
Renovate Bot
c20c232ac2 fix(deps): update dependency mysql2 to v2.2.3 2020-09-21 04:07:21 +00:00
Renovate Bot
3191168116 fix(deps): update dependency graphql-tools to v6.2.3 2020-09-21 03:21:30 +00:00
Renovate Bot
b26ea7c349 chore(deps): update dependency ts-morph to v8.1.1 2020-09-21 03:18:09 +00:00
Renovate Bot
3f7a40fdd9 chore(deps): update dependency ts-loader to v8.0.4 2020-09-21 02:07:07 +00:00
Renovate Bot
f1092a9a12 chore(deps): update dependency typescript to v4.0.3 2020-09-18 20:41:06 +00:00
Michael Kaufman
c77e7412f3 feat(microservices): Updates Kafka options interface 2020-09-18 10:04:05 -04:00
Renovate Bot
4725935f23 fix(deps): update dependency fast-json-stringify to v2.2.7 2020-09-18 09:29:45 +00:00
Kamil Mysliwiec
3c86401c45 Merge pull request #5437 from nestjs/renovate/webpack-4.x
chore(deps): update dependency webpack to v4.44.2
2020-09-18 09:08:39 +02:00
Kamil Mysliwiec
cde348cac2 Merge pull request #5434 from nestjs/renovate/jest-26.x
chore(deps): update dependency @types/jest to v26.0.14
2020-09-18 09:08:28 +02:00
Kamil Mysliwiec
511dca61e7 Merge pull request #5438 from nestjs/renovate/mysql2-2.x
fix(deps): update dependency mysql2 to v2.2.1
2020-09-18 09:08:06 +02:00
Renovate Bot
0c6906f964 fix(deps): update dependency mysql2 to v2.2.1 2020-09-18 06:19:20 +00:00
Renovate Bot
6f9afed3d1 chore(deps): update dependency webpack to v4.44.2 2020-09-18 00:03:22 +00:00
Renovate Bot
cf8eb91bdb chore(deps): update dependency @types/jest to v26.0.14 2020-09-16 16:18:38 +00:00
Kamil Mysliwiec
95c48f8ef3 Merge pull request #5418 from nestjs/renovate/nestjs-typeorm-7.x
fix(deps): update dependency @nestjs/typeorm to v7.1.4
2020-09-16 08:16:29 +02:00
Kamil Mysliwiec
81959f2499 Merge pull request #5419 from nestjs/renovate/fastify-3.x
fix(deps): update dependency fastify to v3.4.1
2020-09-16 08:16:22 +02:00
Kamil Mysliwiec
e309ee7b43 Merge pull request #5424 from nestjs/renovate/wrk-1.x
chore(deps): update dependency wrk to v1.2.1
2020-09-16 08:16:15 +02:00
Kamil Mysliwiec
8fb1286592 Merge pull request #5429 from nestjs/renovate/prettier-2.x
chore(deps): update dependency prettier to v2.1.2
2020-09-16 08:12:17 +02:00
Renovate Bot
299a4efc55 chore(deps): update dependency prettier to v2.1.2 2020-09-16 01:45:52 +00:00
Renovate Bot
314e9a845d chore(deps): update dependency wrk to v1.2.1 2020-09-14 23:53:22 +00:00
Renovate Bot
23c1dd03a8 chore(deps): update typescript-eslint monorepo to v4.1.1 2020-09-14 17:30:11 +00:00
Renovate Bot
ed41c10f03 fix(deps): update dependency fastify to v3.4.1 2020-09-14 13:18:14 +00:00
Renovate Bot
2fb521b4b3 fix(deps): update dependency @nestjs/typeorm to v7.1.4 2020-09-14 07:11:06 +00:00
Kamil Mysliwiec
77a9980469 Merge pull request #5400 from nestjs/renovate/point-of-view-4.x
fix(deps): update dependency point-of-view to v4.5.1
2020-09-14 08:40:38 +02:00
Kamil Mysliwiec
4690c088b2 Merge pull request #5406 from nestjs/dependabot/npm_and_yarn/sample/01-cats-app/node-fetch-2.6.1
chore(deps): bump node-fetch from 2.6.0 to 2.6.1 in /sample/01-cats-app
2020-09-14 08:40:31 +02:00
Kamil Mysliwiec
850f262734 Merge pull request #5408 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.5
2020-09-14 08:40:25 +02:00
Kamil Mysliwiec
42866dd675 Merge pull request #5411 from nestjs/dependabot/npm_and_yarn/sample/13-mongo-typeorm/node-fetch-2.6.1
chore(deps): bump node-fetch from 2.6.0 to 2.6.1 in /sample/13-mongo-typeorm
2020-09-14 08:40:17 +02:00
Kamil Mysliwiec
87cac7319d Merge pull request #5414 from nestjs/renovate/amqp-connection-manager-3.x
chore(deps): update dependency amqp-connection-manager to v3.2.1
2020-09-14 08:40:10 +02:00
Kamil Mysliwiec
f0f9227a6d Merge pull request #5416 from nestjs/renovate/graphql-tools-monorepo
fix(deps): update dependency graphql-tools to v6.2.2
2020-09-14 08:40:02 +02:00
Kamil Mysliwiec
f8ada756f1 Merge pull request #5415 from nestjs/renovate/eslint-7.x
chore(deps): update dependency eslint to v7.9.0
2020-09-14 08:39:53 +02:00
Kamil Mysliwiec
9b083b524c Merge pull request #5417 from nestjs/renovate/major-commitlint-monorepo
chore(deps): update commitlint monorepo to v11 (major)
2020-09-14 08:21:33 +02:00
Renovate Bot
67eb94aab2 chore(deps): update commitlint monorepo to v11 2020-09-14 03:00:31 +00:00
Renovate Bot
8580144282 fix(deps): update dependency graphql-tools to v6.2.2 2020-09-14 01:28:06 +00:00
Renovate Bot
5c39256280 chore(deps): update dependency eslint to v7.9.0 2020-09-14 01:00:35 +00:00
Renovate Bot
f91ac064a4 chore(deps): update dependency amqp-connection-manager to v3.2.1 2020-09-14 00:38:01 +00:00
dependabot[bot]
e426cfa441 chore(deps): bump node-fetch in /sample/13-mongo-typeorm
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 16:40:49 +00:00
Renovate Bot
65e4227806 fix(deps): update dependency mongoose to v5.10.5 2020-09-11 17:36:46 +00:00
Renovate Bot
84dd134d03 fix(deps): update dependency point-of-view to v4.5.1 2020-09-11 06:54:20 +00:00
dependabot[bot]
64403b7105 chore(deps): bump node-fetch from 2.6.0 to 2.6.1 in /sample/01-cats-app
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-11 06:51:09 +00:00
Kamil Mysliwiec
6870e70621 Merge pull request #5404 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.6.2
2020-09-11 08:49:07 +02:00
Kamil Mysliwiec
9ee34cad2c Merge pull request #5403 from nestjs/renovate/fast-json-stringify-2.x
fix(deps): update dependency fast-json-stringify to v2.2.6
2020-09-11 08:48:59 +02:00
Kamil Mysliwiec
d0cc307ce2 Merge pull request #5401 from nestjs/renovate/typeorm-0.x
fix(deps): update dependency typeorm to v0.2.26
2020-09-11 08:48:53 +02:00
Kamil Mysliwiec
d42ff22cd6 Merge pull request #5399 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.4
2020-09-11 08:48:31 +02:00
Kamil Mysliwiec
61069bf6c0 Merge pull request #5373 from nestjs/renovate/socket.io-packages
fix(deps): update dependency socket.io-redis to v5.4.0
2020-09-11 08:48:21 +02:00
Renovate Bot
343dbea98f fix(deps): update dependency mongodb to v3.6.2 2020-09-10 18:43:50 +00:00
Renovate Bot
34af4a6d3d fix(deps): update dependency fast-json-stringify to v2.2.6 2020-09-10 14:27:09 +00:00
Renovate Bot
736e956fe1 fix(deps): update dependency typeorm to v0.2.26 2020-09-10 07:39:16 +00:00
Renovate Bot
8a93acaf4a fix(deps): update dependency mongoose to v5.10.4 2020-09-09 16:05:51 +00:00
Kamil Mysliwiec
4139b3c980 Merge pull request #5397 from nestjs/renovate/nestjs-schematics-7.x
chore(deps): update dependency @nestjs/schematics to v7.1.2
2020-09-08 10:29:05 +02:00
Renovate Bot
d7f9d35349 chore(deps): update dependency @nestjs/schematics to v7.1.2 2020-09-08 08:05:22 +00:00
Kamil Mysliwiec
6a6de086c8 Merge pull request #5395 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v4.1.0
2020-09-08 08:46:14 +02:00
Renovate Bot
5b5c6273ce chore(deps): update typescript-eslint monorepo to v4.1.0 2020-09-07 18:51:34 +00:00
Kamil Mysliwiec
89dc0f19ff Merge pull request #5364 from nestjs/renovate/nestjs-typeorm-7.x
fix(deps): update dependency @nestjs/typeorm to v7.1.3
2020-09-07 14:16:05 +02:00
Kamil Mysliwiec
becf40be9a Merge pull request #5360 from nestjs/renovate/major-typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v4 (major)
2020-09-07 14:15:43 +02:00
Kamil Mysliwiec
c46511cc9a Merge pull request #5367 from nestjs/renovate/express-4.x
chore(deps): update dependency @types/express to v4.17.8
2020-09-07 13:55:54 +02:00
Kamil Mysliwiec
e143096f3c Merge pull request #5365 from nestjs/renovate/graphql-tools-monorepo
fix(deps): update dependency graphql-tools to v6.2.1
2020-09-07 13:54:47 +02:00
Kamil Mysliwiec
449953710e Merge pull request #5393 from nestjs/renovate/husky-4.x
chore(deps): update dependency husky to v4.3.0
2020-09-07 13:54:34 +02:00
Kamil Mysliwiec
85c6be1a40 Merge pull request #5374 from kkoomen/feature/ignore-buffer-metatype
Ignore Buffer metatypes in validation pipe
2020-09-07 13:07:10 +02:00
Renovate Bot
8ec5417360 chore(deps): update typescript-eslint monorepo to v4 2020-09-07 10:52:58 +00:00
Renovate Bot
110e60f355 fix(deps): update dependency socket.io-redis to v5.4.0 2020-09-07 10:30:27 +00:00
Renovate Bot
5b886fec7e fix(deps): update dependency graphql-tools to v6.2.1 2020-09-07 10:29:26 +00:00
Renovate Bot
90834dc096 fix(deps): update dependency @nestjs/typeorm to v7.1.3 2020-09-07 10:26:30 +00:00
Renovate Bot
fd693927cd chore(deps): update dependency husky to v4.3.0 2020-09-07 10:23:10 +00:00
Renovate Bot
a94317cc46 chore(deps): update dependency @types/express to v4.17.8 2020-09-07 09:38:37 +00:00
Kamil Mysliwiec
d9adc356e4 Merge pull request #5361 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo
2020-09-07 10:56:58 +02:00
Kamil Mysliwiec
9248c40f93 Merge pull request #5362 from nestjs/renovate/jest-26.x
chore(deps): update dependency @types/jest to v26.0.13
2020-09-07 10:56:51 +02:00
Kamil Mysliwiec
f8d7433fe4 Merge pull request #5363 from nestjs/renovate/eslint-7.x
chore(deps): update dependency eslint to v7.8.1
2020-09-07 10:56:45 +02:00
Kamil Mysliwiec
0eb10c2c88 Merge pull request #5368 from nestjs/renovate/cache-manager-3.x
chore(deps): update dependency cache-manager to v3.4.0
2020-09-07 10:56:16 +02:00
Kamil Mysliwiec
d36459fff8 Merge pull request #5369 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.27
2020-09-07 10:56:08 +02:00
Kamil Mysliwiec
acc29ea385 Merge pull request #5370 from nestjs/renovate/point-of-view-4.x
fix(deps): update dependency point-of-view to v4.5.0
2020-09-07 10:56:01 +02:00
Kamil Mysliwiec
b7e4afe34e Merge pull request #5376 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.6.1
2020-09-07 10:55:47 +02:00
Kamil Mysliwiec
8c008105c0 Merge pull request #5378 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.3.0
2020-09-07 10:55:40 +02:00
Kamil Mysliwiec
46fcfd9b64 Merge pull request #5381 from nestjs/renovate/fastify-multipart-3.x
chore(deps): update dependency fastify-multipart to v3.2.0
2020-09-07 10:55:33 +02:00
Kamil Mysliwiec
5e0e0ba22a Merge pull request #5382 from nestjs/dependabot/npm_and_yarn/sample/13-mongo-typeorm/bl-2.2.1
chore(deps): bump bl from 2.2.0 to 2.2.1 in /sample/13-mongo-typeorm
2020-09-07 10:55:25 +02:00
Kamil Mysliwiec
0ac74d383f Merge pull request #5383 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.10.3
2020-09-07 10:55:20 +02:00
Kamil Mysliwiec
9200ed6c81 Merge pull request #5390 from nestjs/renovate/fast-json-stringify-2.x
fix(deps): update dependency fast-json-stringify to v2.2.4
2020-09-07 10:55:13 +02:00
Kamil Mysliwiec
9e022ad77b Merge pull request #5391 from nestjs/renovate/rxjs-6.x
fix(deps): update dependency rxjs to v6.6.3
2020-09-07 10:55:07 +02:00
Kamil Mysliwiec
ae45b6a079 Merge pull request #5387 from gelito/patch-1
Update server-rmq.ts
2020-09-07 10:46:46 +02:00
Kamil Mysliwiec
6951502d25 Merge pull request #5389 from nestjs/renovate/rxjs-compat-6.x
chore(deps): update dependency rxjs-compat to v6.6.3
2020-09-07 09:34:25 +02:00
Renovate Bot
dcaba8e2e9 fix(deps): update dependency rxjs to v6.6.3 2020-09-07 02:22:51 +00:00
Renovate Bot
3e024bb9cb fix(deps): update dependency fast-json-stringify to v2.2.4 2020-09-07 00:48:49 +00:00
Renovate Bot
8d7cb60894 chore(deps): update dependency rxjs-compat to v6.6.3 2020-09-07 00:46:34 +00:00
Ángel Luis Quesada Nieto
cfe419f370 Update server-rmq.ts
Changed the private for protected in order to be able to extend and modify the ServerRMQ
2020-09-06 18:05:21 +02:00
Renovate Bot
bbd7ac9219 fix(deps): update dependency mongoose to v5.10.3 2020-09-03 20:16:56 +00:00
dependabot[bot]
8d9f868a91 chore(deps): bump bl from 2.2.0 to 2.2.1 in /sample/13-mongo-typeorm
Bumps [bl](https://github.com/rvagg/bl) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v2.2.0...v2.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-03 19:28:11 +00:00
Renovate Bot
4e314b4352 chore(deps): update dependency fastify-multipart to v3.2.0 2020-09-03 18:40:17 +00:00
Renovate Bot
fdef13f3de chore(deps): update babel monorepo 2020-09-03 16:13:47 +00:00
Renovate Bot
f0cbf063e8 chore(deps): update dependency lint-staged to v10.3.0 2020-09-03 08:21:44 +00:00
Renovate Bot
7e93cf759f chore(deps): update dependency @types/jest to v26.0.13 2020-09-02 16:21:37 +00:00
Renovate Bot
968374e0c9 fix(deps): update dependency mongodb to v3.6.1 2020-09-02 13:13:29 +00:00
Kim 金可明
534bb5bc50 feat(validation.pipe): ignore buffer metatypes 2020-09-02 16:28:23 +08:00
Renovate Bot
2b96efd5fb chore(deps): update dependency eslint to v7.8.1 2020-09-01 21:27:42 +00:00
Renovate Bot
6895ae42c1 fix(deps): update dependency point-of-view to v4.5.0 2020-09-01 18:13:34 +00:00
Renovate Bot
4c6d145853 chore(deps): update dependency @types/redis to v2.8.27 2020-09-01 16:30:32 +00:00
Renovate Bot
645b474c49 chore(deps): update dependency cache-manager to v3.4.0 2020-09-01 16:17:01 +00:00
mehdi-sh-hm
1c38a2dd2d feat(common): add support for conditional cache ttl 2020-09-01 04:25:52 -04:00
Kamil Mysliwiec
9af0887613 Merge pull request #5359 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v7.4.4
2020-08-31 13:32:30 +02:00
Renovate Bot
0472533d39 fix(deps): update nest monorepo to v7.4.4 2020-08-31 11:07:39 +00:00
Prince
253f8cc565 Merge branch 'added-abort-on-error-in-nestapplication-context-options' of https://github.com/princechauhan1992/nest into added-abort-on-error-in-nestapplication-context-options 2020-08-25 18:01:04 +05:30
Prince
8b9a1b7425 feat(core): Add abortOnError option in NestApplicationContextOptions 2020-08-25 17:57:21 +05:30
Prince
ddb3a62cac feat(core): Add abortOnError option in NestApplicationContextOptions 2020-08-25 16:45:35 +05:30
Mike Drakoulelis
35d997c17b fix: stricten unit test file pattern
The unit test file pattern strictly follows the .spec.ts file suffix. This rules out .e2e-spec.ts files from unit tests.

Closes #5293
2020-08-20 12:11:03 +03:00
Opportunity
f85e1fa74e fix(core): fix #5140
Use .toString() as functions' representation.
2020-08-01 17:49:17 +08:00
alex
4ae1750235 feat(microservices): fix "RpcParamtype.GRPC_CALL" enum name 2020-07-29 13:46:17 +03:00
alex
cdbe127d5b feat(microservices): fix "RpcParamtype.GRPC_CALL" enum name 2020-07-29 13:44:24 +03:00
alex
bc38c70e31 feat(microservices): Add grpc metadata to server responce
example of usage:

import { Metadata } from 'grpc';

@GrpcMethod('Service', 'Method')
public method(request: any, metadata: Metadata, call: any): any {
   // 1. nothing to do with request that is empty in this case
   // 2. may something with metadata from client if needed
   // 3. send metadata with responce........
   const srvMetadata = new Metadata();

   srvMetadata.add('Set-Cookie', 'yummy_cookie=choco');

   call.sendMetadata(srvMetadata);

   return 'Hello World!!!';
}
2020-07-29 12:06:42 +03:00
alex
162f1a8e2d Merge branch 'master' into grpc-send-metadata 2020-07-29 11:14:02 +03:00
alex
b766c7451d feat(microservices): Add grpc metadata to server responce
example of usage:

import { Metadata } from 'grpc';

@GrpcMethod('Service', 'Method')
public method(request: any, metadata: Metadata, sendMetadata: any): any {
   // 1. nothing to do with request that is empty in this case
   // 2. may something with metadata from client if needed
   // 3. send metadata with responce........
   const srvMetadata = new Metadata();

   srvMetadata.add('Set-Cookie', 'yummy_cookie=choco');

   sendMetadata(srvMetadata);

   return 'Hello World!!!';
}
2020-07-24 10:58:44 +03:00
213 changed files with 102732 additions and 43287 deletions

7
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

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

@@ -66,7 +66,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
#### Sponsors
@@ -84,12 +85,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
<td align="center" valign="middle">
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" 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/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/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
</tr></table>
## Backers

View File

@@ -23,7 +23,7 @@ services:
- "9001:9001"
restart: always
mysql:
image: mysql:5.7.31
image: mysql:5.7.32
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
@@ -48,7 +48,7 @@ services:
zookeeper:
container_name: test-zookeeper
hostname: zookeeper
image: confluentinc/cp-zookeeper:5.3.2
image: confluentinc/cp-zookeeper:5.5.2
ports:
- "2181:2181"
environment:
@@ -57,7 +57,7 @@ services:
kafka:
container_name: test-kafka
hostname: kafka
image: confluentinc/cp-kafka:5.5.1
image: confluentinc/cp-kafka:5.5.2
depends_on:
- zookeeper
ports:

View File

@@ -63,6 +63,14 @@ describe('Hello world (fastify adapter)', () => {
});
});
it(`/GET inject with LightMyRequest chaining API`, () => {
return app
.inject()
.get('/hello')
.end()
.then(({ payload }) => expect(payload).to.be.eql('Hello world!'));
});
afterEach(async () => {
await app.close();
});

View File

@@ -113,6 +113,11 @@ describe('Advanced GRPC transport', () => {
it('GRPC Sending and receiving Stream from RX handler', async () => {
const callHandler = client.sync();
// Get Set-Cookie from Metadata
callHandler.on('metadata', (metadata: GRPC.Metadata) => {
expect(metadata.get('Set-Cookie')[0]).to.eq('test_cookie=abcd');
});
callHandler.on('data', (msg: number) => {
// Do deep comparison (to.eql)
expect(msg).to.eql({

View File

@@ -9,6 +9,7 @@ import {
} from '@nestjs/microservices';
import { join } from 'path';
import { Observable, of, ReplaySubject, Subject } from 'rxjs';
import { Metadata } from 'grpc';
@Controller()
export class AdvancedGrpcController {
@@ -84,7 +85,16 @@ export class AdvancedGrpcController {
* @param messages
*/
@GrpcStreamMethod('orders.OrderService')
async sync(messages: Observable<any>): Promise<any> {
async sync(
messages: Observable<any>,
metadata: Metadata,
call: any,
): Promise<any> {
// Set Set-Cookie from Metadata
const srvMetadata = new Metadata();
srvMetadata.add('Set-Cookie', 'test_cookie=abcd');
call.sendMetadata(srvMetadata);
const s = new Subject();
const o = s.asObservable();
messages.subscribe(msg => {

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 {

View File

@@ -28,5 +28,18 @@ describe('WebSocketGateway (ack)', () => {
);
});
it(`should handle message with ack & without data (http)`, async () => {
app = await createNestApp(AckGateway);
await app.listenAsync(3000);
ws = io.connect('http://localhost:8080');
await new Promise(resolve =>
ws.emit('push', data => {
expect(data).to.be.eql('pong');
resolve();
}),
);
});
afterEach(() => app.close());
});

View File

@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "7.4.4"
"version": "7.5.5"
}

7536
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "7.4.0",
"version": "7.5.3",
"description": "Modern, fast, powerful node.js web framework",
"homepage": "https://nestjs.com",
"repository": {
@@ -51,119 +51,120 @@
]
},
"dependencies": {
"@nuxtjs/opencollective": "0.2.2",
"axios": "0.20.0",
"@nuxtjs/opencollective": "0.3.2",
"axios": "0.21.0",
"class-transformer": "0.3.1",
"class-validator": "0.12.2",
"cli-color": "2.0.0",
"cors": "2.8.5",
"express": "4.17.1",
"fast-json-stringify": "2.2.3",
"fast-json-stringify": "2.2.10",
"fast-safe-stringify": "2.0.7",
"iterare": "1.2.1",
"object-hash": "2.0.3",
"path-to-regexp": "3.2.0",
"reflect-metadata": "0.1.13",
"rxjs": "6.6.2",
"rxjs": "6.6.3",
"socket.io": "2.3.0",
"uuid": "8.3.0",
"tslib": "2.0.1"
"uuid": "8.3.1",
"tslib": "2.0.3"
},
"devDependencies": {
"@codechecks/client": "0.1.10",
"@commitlint/cli": "9.1.2",
"@commitlint/config-angular": "9.1.2",
"@commitlint/cli": "11.0.0",
"@commitlint/config-angular": "11.0.0",
"@grpc/proto-loader": "0.5.5",
"@nestjs/graphql": "7.6.0",
"@nestjs/mongoose": "7.0.2",
"@nestjs/typeorm": "7.1.1",
"@types/amqplib": "0.5.13",
"@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.12",
"@types/chai": "4.2.14",
"@types/chai-as-promised": "7.1.3",
"@types/cors": "2.8.7",
"@types/express": "4.17.7",
"@types/gulp": "4.0.6",
"@types/mocha": "8.0.3",
"@types/mongoose": "5.7.36",
"@types/node": "10.17.3",
"@types/redis": "2.8.26",
"@types/reflect-metadata": "0.0.5",
"@types/sinon": "9.0.5",
"@types/socket.io": "2.1.11",
"@types/ws": "7.2.6",
"@typescript-eslint/eslint-plugin": "3.10.1",
"@typescript-eslint/parser": "3.10.1",
"amqp-connection-manager": "3.2.0",
"@types/cors": "2.8.8",
"@types/express": "4.17.9",
"@types/gulp": "4.0.7",
"@types/mocha": "8.0.4",
"@types/mongoose": "5.10.2",
"@types/node": "14.14.10",
"@types/redis": "2.8.28",
"@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.17.0",
"apollo-server-express": "2.19.0",
"artillery": "1.6.1",
"awesome-typescript-loader": "5.2.1",
"body-parser": "1.19.0",
"bytes": "3.1.0",
"cache-manager": "3.3.0",
"cache-manager": "3.4.0",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"clang-format": "1.4.0",
"commitlint-circle": "1.0.0",
"concurrently": "5.3.0",
"conventional-changelog": "3.1.23",
"core-js": "3.6.5",
"conventional-changelog": "3.1.24",
"core-js": "3.8.1",
"coveralls": "3.1.0",
"delete-empty": "3.0.0",
"engine.io-client": "3.4.3",
"eslint": "7.7.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"engine.io-client": "4.0.4",
"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.3.0",
"fastify-cors": "4.1.0",
"fastify": "3.9.1",
"fastify-cors": "5.0.0",
"fastify-formbody": "5.0.0",
"fastify-multipart": "3.1.0",
"fastify-static": "3.2.0",
"graphql": "15.3.0",
"graphql-tools": "6.1.0",
"grpc": "1.24.3",
"fastify-multipart": "3.3.1",
"fastify-static": "3.3.0",
"graphql": "15.4.0",
"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.2.5",
"imports-loader": "1.1.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.0.2",
"lint-staged": "10.2.13",
"light-my-request": "4.3.0",
"lint-staged": "10.5.3",
"markdown-table": "2.0.0",
"merge-graphql-schemas": "1.7.8",
"middie": "5.1.0",
"mocha": "8.1.3",
"mongoose": "5.10.2",
"mqtt": "4.2.1",
"middie": "5.2.0",
"mocha": "8.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.4",
"nodemon": "2.0.6",
"nyc": "15.1.0",
"point-of-view": "4.4.0",
"prettier": "2.1.1",
"point-of-view": "4.7.0",
"prettier": "2.2.1",
"redis": "3.0.2",
"rxjs-compat": "6.6.2",
"sinon": "9.0.3",
"rxjs-compat": "6.6.3",
"sinon": "9.2.1",
"sinon-chai": "3.5.0",
"socket.io-client": "2.3.0",
"socket.io-client": "2.3.1",
"subscriptions-transport-ws": "0.9.18",
"supertest": "4.0.2",
"ts-morph": "8.1.0",
"ts-node": "9.0.0",
"typeorm": "0.2.25",
"typescript": "4.0.2",
"wrk": "1.2.0",
"ws": "7.3.1"
"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.1"
},
"engines": {
"node": ">= 10.13.0"

View File

@@ -66,7 +66,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
#### Sponsors
@@ -84,12 +85,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
<td align="center" valign="middle">
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" 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/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/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
</tr></table>
## Backers

View File

@@ -1,4 +1,5 @@
import { SetMetadata } from '../../decorators';
import { ExecutionContext } from '../../interfaces/features/execution-context.interface';
import { CACHE_TTL_METADATA } from '../cache.constants';
/**
@@ -12,4 +13,6 @@ import { CACHE_TTL_METADATA } from '../cache.constants';
*
* @publicApi
*/
export const CacheTTL = (ttl: number) => SetMetadata(CACHE_TTL_METADATA, ttl);
type CacheTTLFactory = (ctx: ExecutionContext) => Promise<number> | number;
export const CacheTTL = (ttl: number | CacheTTLFactory) =>
SetMetadata(CACHE_TTL_METADATA, ttl);

View File

@@ -1,4 +1,4 @@
export { CACHE_MANAGER } from './cache.constants';
export * from './cache.constants';
export * from './cache.module';
export * from './decorators';
export * from './interceptors';

View File

@@ -7,7 +7,7 @@ import {
HttpServer,
NestInterceptor,
} from '../../interfaces';
import { isNil } from '../../utils/shared.utils';
import { isFunction, isNil } from '../../utils/shared.utils';
import {
CACHE_KEY_METADATA,
CACHE_MANAGER,
@@ -37,7 +37,7 @@ export class CacheInterceptor implements NestInterceptor {
next: CallHandler,
): Promise<Observable<any>> {
const key = this.trackBy(context);
const ttl =
const ttlValueOrFactory =
this.reflector.get(CACHE_TTL_METADATA, context.getHandler()) || null;
if (!key) {
@@ -48,7 +48,9 @@ export class CacheInterceptor implements NestInterceptor {
if (!isNil(value)) {
return of(value);
}
const ttl = isFunction(ttlValueOrFactory)
? await ttlValueOrFactory(context)
: ttlValueOrFactory;
return next.handle().pipe(
tap(response => {
const args = isNil(ttl) ? [key, response] : [key, response, { ttl }];

View File

@@ -26,3 +26,5 @@ export const HTTP_CODE_METADATA = '__httpCode__';
export const MODULE_PATH = '__module_path__';
export const HEADERS_METADATA = '__headers__';
export const REDIRECT_METADATA = '__redirect__';
export const RESPONSE_PASSTHROUGH_METADATA = '__responsePassthrough__';
export const SSE_METADATA = '__sse__';

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

@@ -5,3 +5,4 @@ export * from './create-route-param-metadata.decorator';
export * from './render.decorator';
export * from './header.decorator';
export * from './redirect.decorator';
export * from './sse.decorator';

View File

@@ -1,9 +1,26 @@
import { ROUTE_ARGS_METADATA } from '../../constants';
import {
RESPONSE_PASSTHROUGH_METADATA,
ROUTE_ARGS_METADATA,
} from '../../constants';
import { RouteParamtypes } from '../../enums/route-paramtypes.enum';
import { PipeTransform } from '../../index';
import { Type } from '../../interfaces';
import { isNil, isString } from '../../utils/shared.utils';
/**
* The `@Response()`/`@Res` parameter decorator options.
*/
export interface ResponseDecoratorOptions {
/**
* Determines whether the response will be sent manually within the route handler,
* with the use of native response handling methods exposed by the platform-specific response object,
* or if it should passthrough Nest response processing pipeline.
*
* @default false
*/
passthrough: boolean;
}
export type ParamData = object | string | number;
export interface RouteParamMetadata {
index: number;
@@ -85,21 +102,35 @@ export const Request: () => ParameterDecorator = createRouteParamDecorator(
*
* Example: `logout(@Response() res)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Response: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.RESPONSE,
);
export const Response: (
options?: ResponseDecoratorOptions,
) => ParameterDecorator = (options?: ResponseDecoratorOptions) => (
target,
key,
index,
) => {
if (options?.passthrough) {
Reflect.defineMetadata(
RESPONSE_PASSTHROUGH_METADATA,
options?.passthrough,
target.constructor,
key,
);
}
return createRouteParamDecorator(RouteParamtypes.RESPONSE)()(
target,
key,
index,
);
};
/**
* Route handler parameter decorator. Extracts reference to the `Next` function
* from the underlying platform and populates the decorated
* parameter with the value of `Next`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Next: () => ParameterDecorator = createRouteParamDecorator(

View File

@@ -0,0 +1,26 @@
import { METHOD_METADATA, PATH_METADATA, SSE_METADATA } from '../../constants';
import { RequestMethod } from '../../enums/request-method.enum';
/**
* Declares this route as a Server-Sent-Events endpoint
*
* @publicApi
*/
export function Sse(path?: string): MethodDecorator {
return (
target: object,
key: string | symbol,
descriptor: TypedPropertyDescriptor<any>,
) => {
path = path && path.length ? path : '/';
Reflect.defineMetadata(PATH_METADATA, path, descriptor.value);
Reflect.defineMetadata(
METHOD_METADATA,
RequestMethod.GET,
descriptor.value,
);
Reflect.defineMetadata(SSE_METADATA, true, descriptor.value);
return descriptor;
};
}

View File

@@ -2,6 +2,7 @@ export enum HttpStatus {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
PROCESSING = 102,
EARLYHINTS = 103,
OK = 200,
CREATED = 201,
ACCEPTED = 202,
@@ -35,6 +36,7 @@ export enum HttpStatus {
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
EXPECTATION_FAILED = 417,
I_AM_A_TEAPOT = 418,
MISDIRECTED = 421,
UNPROCESSABLE_ENTITY = 422,
FAILED_DEPENDENCY = 424,
TOO_MANY_REQUESTS = 429,

View File

@@ -2,7 +2,7 @@ import { HttpStatus } from '../enums/http-status.enum';
import { HttpException } from './http.exception';
/**
* Defines an HTTP exception for *Gatway Timeout* type errors.
* Defines an HTTP exception for *Gateway Timeout* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*

View File

@@ -67,14 +67,15 @@ export class HttpException extends Error {
public static createBody(
objectOrError: object | string,
message?: string,
description?: string,
statusCode?: number,
) {
if (!objectOrError) {
return { statusCode, message };
return { statusCode, message: description };
}
return isObject(objectOrError) && !Array.isArray(objectOrError)
? objectOrError
: { statusCode, message: objectOrError, error: message };
: { statusCode, message: objectOrError, error: description };
}
}

View File

@@ -19,3 +19,4 @@ export * from './service-unavailable.exception';
export * from './gateway-timeout.exception';
export * from './im-a-teapot.exception';
export * from './precondition-failed.exception';
export * from './misdirected.exception';

View File

@@ -0,0 +1,49 @@
import { HttpStatus } from '../enums/http-status.enum';
import { HttpException } from './http.exception';
/**
* Defines an HTTP exception for *Misdirected* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class MisdirectedException extends HttpException {
/**
* Instantiate a `MisdirectedException` Exception.
*
* @example
* `throw new MisdirectedException()`
*
* @usageNotes
* The HTTP response status code will be 421.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `description` argument contains a short description of the HTTP error.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 421.
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param description a short description of the HTTP error.
*/
constructor(
objectOrError?: string | object | any,
description = 'Misdirected',
) {
super(
HttpException.createBody(
objectOrError,
description,
HttpStatus.MISDIRECTED,
),
HttpStatus.MISDIRECTED,
);
}
}

View File

@@ -31,6 +31,7 @@ export {
INestApplicationContext,
INestMicroservice,
IntrospectionResult,
MessageEvent,
MiddlewareConsumer,
ModuleMetadata,
NestApplicationOptions,

View File

@@ -0,0 +1,2 @@
export * from './http-server.interface';
export * from './message-event.interface';

View File

@@ -0,0 +1,6 @@
export interface MessageEvent {
data: string | object;
id?: string;
type?: string;
retry?: number;
}

View File

@@ -13,7 +13,7 @@ export * from './features/nest-interceptor.interface';
export * from './features/paramtype.interface';
export * from './features/pipe-transform.interface';
export * from './hooks';
export * from './http/http-server.interface';
export * from './http';
export * from './injectable.interface';
export * from './microservices/nest-hybrid-application-options.interface';
export * from './middleware';

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 DynamicModule extends ModuleMetadata {
* in all modules. Thereafter, modules that wish to inject a service exported
* from a global module do not need to import the provider module.
*
* Default: false
* @default false
*/
global?: boolean;
}

View File

@@ -8,4 +8,11 @@ export class NestApplicationContextOptions {
* Specifies the logger to use. Pass `false` to turn off logging.
*/
logger?: LoggerService | LogLevel[] | boolean;
/**
* Whether to abort the process on Error. By default, the process is exited.
* Pass `false` to override the default behavior. If `false` is passed, Nest will not exit
* the application and instead will rethrow the exception.
*/
abortOnError?: boolean | undefined;
}

View File

@@ -1,5 +1,5 @@
import { ShutdownSignal } from '../enums/shutdown-signal.enum';
import { LoggerService } from '../services/logger.service';
import { LoggerService, LogLevel } from '../services/logger.service';
import { Abstract } from './abstract.interface';
import { Type } from './type.interface';
@@ -53,7 +53,7 @@ export interface INestApplicationContext {
* Sets custom logger service
* @returns {void}
*/
useLogger(logger: LoggerService): void;
useLogger(logger: LoggerService | LogLevel[] | false): void;
/**
* Enables the usage of shutdown hooks. Will call the

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

@@ -1,6 +1,6 @@
{
"name": "@nestjs/common",
"version": "7.4.4",
"version": "7.5.5",
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
"author": "Kamil Mysliwiec",
"homepage": "https://nestjs.com",
@@ -17,11 +17,10 @@
},
"license": "MIT",
"dependencies": {
"axios": "0.20.0",
"cli-color": "2.0.0",
"axios": "0.21.0",
"iterare": "1.2.1",
"tslib": "2.0.1",
"uuid": "8.3.0"
"tslib": "2.0.3",
"uuid": "8.3.1"
},
"peerDependencies": {
"reflect-metadata": "^0.1.12",

View File

@@ -60,16 +60,28 @@ export class ValidationPipe implements PipeTransform<any> {
this.exceptionFactory =
options.exceptionFactory || this.createExceptionFactory();
classValidator = loadPackage('class-validator', 'ValidationPipe', () =>
classValidator = this.loadValidator();
classTransformer = this.loadTransformer();
}
protected loadValidator() {
return loadPackage('class-validator', 'ValidationPipe', () =>
require('class-validator'),
);
classTransformer = loadPackage('class-transformer', 'ValidationPipe', () =>
}
protected loadTransformer() {
return loadPackage('class-transformer', 'ValidationPipe', () =>
require('class-transformer'),
);
}
public async transform(value: any, metadata: ArgumentMetadata) {
const metatype = this.expectedType || metadata.metatype;
if (this.expectedType) {
metadata = { ...metadata, metatype: this.expectedType };
}
const metatype = metadata.metatype;
if (!metatype || !this.toValidate(metadata)) {
return this.isTransformEnabled
? this.transformPrimitive(value, metadata)
@@ -101,7 +113,7 @@ export class ValidationPipe implements PipeTransform<any> {
const errors = await classValidator.validate(entity, this.validatorOptions);
if (errors.length > 0) {
throw this.exceptionFactory(errors);
throw await this.exceptionFactory(errors);
}
if (isPrimitive) {
// if the value is a primitive value and the validation process has been successfully completed
@@ -130,16 +142,16 @@ export class ValidationPipe implements PipeTransform<any> {
};
}
private toValidate(metadata: ArgumentMetadata): boolean {
protected toValidate(metadata: ArgumentMetadata): boolean {
const { metatype, type } = metadata;
if (type === 'custom' && !this.validateCustomDecorators) {
return false;
}
const types = [String, Boolean, Number, Array, Object];
const types = [String, Boolean, Number, Array, Object, Buffer];
return !types.some(t => metatype === t) && !isNil(metatype);
}
private transformPrimitive(value: any, metadata: ArgumentMetadata) {
protected transformPrimitive(value: any, metadata: ArgumentMetadata) {
if (!metadata.data) {
// leave top-level query/param objects unmodified
return value;
@@ -157,11 +169,11 @@ export class ValidationPipe implements PipeTransform<any> {
return value;
}
private toEmptyIfNil<T = any, R = any>(value: T): R | {} {
protected toEmptyIfNil<T = any, R = any>(value: T): R | {} {
return isNil(value) ? {} : value;
}
private stripProtoKeys(value: Record<string, any>) {
protected stripProtoKeys(value: Record<string, any>) {
delete value.__proto__;
const keys = Object.keys(value);
iterate(keys)
@@ -169,11 +181,11 @@ export class ValidationPipe implements PipeTransform<any> {
.forEach(key => this.stripProtoKeys(value[key]));
}
private isPrimitive(value: unknown): boolean {
protected isPrimitive(value: unknown): boolean {
return ['number', 'boolean', 'string'].includes(typeof value);
}
private flattenValidationErrors(
protected flattenValidationErrors(
validationErrors: ValidationError[],
): string[] {
return iterate(validationErrors)
@@ -185,7 +197,7 @@ export class ValidationPipe implements PipeTransform<any> {
.toArray();
}
private mapChildrenToValidationErrors(
protected mapChildrenToValidationErrors(
error: ValidationError,
): ValidationError[] {
if (!(error.children && error.children.length)) {
@@ -201,7 +213,7 @@ export class ValidationPipe implements PipeTransform<any> {
return validationErrors;
}
private prependConstraintsWithParentProp(
protected prependConstraintsWithParentProp(
parentError: ValidationError,
error: ValidationError,
): ValidationError {

View File

@@ -1,10 +1,9 @@
import * as clc from 'cli-color';
import { Injectable } from '../decorators/core/injectable.decorator';
import { Optional } from '../decorators/core/optional.decorator';
import { clc, yellow } from '../utils/cli-colors.util';
import { isObject } from '../utils/shared.utils';
declare const process: any;
const yellow = clc.xterm(3);
export type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';
@@ -26,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,
@@ -62,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;
@@ -96,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,
@@ -115,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;
}
@@ -134,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

@@ -0,0 +1,23 @@
import { expect } from 'chai';
import { METHOD_METADATA, PATH_METADATA, SSE_METADATA } from '../../constants';
import { Sse } from '../../decorators/http/sse.decorator';
import { RequestMethod } from '../../enums/request-method.enum';
describe('@Sse', () => {
const prefix = '/prefix';
class Test {
@Sse(prefix)
public static test() {}
}
it('should enhance method with expected http status code', () => {
const path = Reflect.getMetadata(PATH_METADATA, Test.test);
expect(path).to.be.eql('/prefix');
const method = Reflect.getMetadata(METHOD_METADATA, Test.test);
expect(method).to.be.eql(RequestMethod.GET);
const metadata = Reflect.getMetadata(SSE_METADATA, Test.test);
expect(metadata).to.be.eql(true);
});
});

View File

@@ -32,12 +32,12 @@ describe('@UseGuards', () => {
expect(metadata).to.be.eql(guards);
});
it('should enhance class with multiple guards array', () => {
it('should enhance method with multiple guards array', () => {
const metadata = Reflect.getMetadata(GUARDS_METADATA, Test2.test);
expect(metadata).to.be.eql(guards.concat(guards));
});
it('when object is invalid should throw exception', () => {
it('should throw exception when object is invalid', () => {
try {
UseGuards('test' as any)(() => {});
} catch (e) {

View File

@@ -403,7 +403,7 @@ describe('ValidationPipe', () => {
public prop1: string;
@IsBoolean()
public prop2: string;
public prop2: boolean;
@IsOptional()
@IsString()
@@ -422,5 +422,18 @@ describe('ValidationPipe', () => {
expect(await target.transform(testObj, m)).to.equal(testObj);
});
it('should validate against the expected type if presented and metatype is primitive type', async () => {
const m: ArgumentMetadata = {
type: 'body',
metatype: String,
data: '',
};
target = new ValidationPipe({ expectedType: TestModel });
const testObj = { prop1: 'value1', prop2: 'value2' };
expect(await target.transform(testObj, m)).to.equal(testObj);
});
});
});

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

@@ -0,0 +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: 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 = 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

@@ -66,7 +66,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
#### Sponsors
@@ -84,12 +85,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
<td align="center" valign="middle">
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" 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/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/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
</tr></table>
## Backers

View File

@@ -1,5 +1,8 @@
import { ParamData } from '@nestjs/common';
import { PARAMTYPES_METADATA } from '@nestjs/common/constants';
import {
PARAMTYPES_METADATA,
RESPONSE_PASSTHROUGH_METADATA,
} from '@nestjs/common/constants';
import {
ContextType,
Controller,
@@ -38,6 +41,14 @@ export class ContextUtils {
return Reflect.getMetadata(metadataKey, instance.constructor, methodName);
}
public reflectPassthrough(instance: Controller, methodName: string): boolean {
return Reflect.getMetadata(
RESPONSE_PASSTHROUGH_METADATA,
instance.constructor,
methodName,
);
}
public getArgumentsLength<T>(keys: string[], metadata: T): number {
return Math.max(...keys.map(key => metadata[key].index)) + 1;
}

View File

@@ -1,11 +1,32 @@
import { Type } from '@nestjs/common';
import { Controller } from '@nestjs/common/interfaces';
import { IncomingMessage } from 'http';
import { Observable } from 'rxjs';
import { CONTROLLER_ID_KEY } from '../injector/constants';
import { ContextId } from '../injector/instance-wrapper';
import { HeaderStream } from '../router/sse-stream';
import { ParamProperties } from './context-utils';
export const HANDLER_METADATA_SYMBOL = Symbol.for('handler_metadata:cache');
export type HandleResponseFn = HandlerResponseBasicFn | HandleSseResponseFn;
export type HandlerResponseBasicFn = <TResult, TResponse>(
result: TResult,
res: TResponse,
req?: any,
) => any;
export type HandleSseResponseFn = <
TResult extends Observable<unknown> = any,
TResponse extends HeaderStream = any,
TRequest extends IncomingMessage = any
>(
result: TResult,
res: TResponse,
req: TRequest,
) => any;
export interface HandlerMetadata {
argsLength: number;
paramtypes: any[];
@@ -17,10 +38,7 @@ export interface HandlerMetadata {
contextId?: ContextId,
inquirerId?: string,
) => (ParamProperties & { metatype?: any })[];
fnHandleResponse: <TResult, TResponse>(
result: TResult,
res: TResponse,
) => any;
fnHandleResponse: HandleResponseFn;
}
export class HandlerMetadataStorage<

View File

@@ -0,0 +1,3 @@
export const rethrow = (err: unknown) => {
throw err;
};

View File

@@ -47,7 +47,11 @@ export class ModuleTokenFactory {
private replacer(key: string, value: any) {
if (typeof value === 'function') {
return value.name;
const isClass = /^class\s/.test(Function.prototype.toString.call(value));
if (isClass) {
return value.name;
}
return hash(value.toString(), { ignoreUnknown: true });
}
return value;
}

View File

@@ -6,8 +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 { Type } from '@nestjs/common/interfaces/type.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';
@@ -105,18 +107,19 @@ export class MiddlewareModule {
applicationRef: any,
) {
const configs = middlewareContainer.getConfigurations();
const registerAllConfigs = (
const registerAllConfigs = async (
moduleKey: string,
middlewareConfig: MiddlewareConfiguration[],
) =>
middlewareConfig.map(async (config: MiddlewareConfiguration) => {
) => {
for (const config of middlewareConfig) {
await this.registerMiddlewareConfig(
middlewareContainer,
config,
moduleKey,
applicationRef,
);
});
}
};
const entriesSortedByDistance = [...configs.entries()].sort(
([moduleA], [moduleB]) => {
@@ -126,10 +129,9 @@ export class MiddlewareModule {
);
},
);
const registerModuleConfigs = async ([module, moduleConfigs]) => {
await Promise.all(registerAllConfigs(module, [...moduleConfigs]));
};
await Promise.all(entriesSortedByDistance.map(registerModuleConfigs));
for (const [moduleRef, moduleConfigurations] of entriesSortedByDistance) {
await registerAllConfigs(moduleRef, [...moduleConfigurations]);
}
}
public async registerMiddlewareConfig(
@@ -139,9 +141,7 @@ export class MiddlewareModule {
applicationRef: any,
) {
const { forRoutes } = config;
const registerRouteMiddleware = async (
routeInfo: Type<any> | string | RouteInfo,
) => {
for (const routeInfo of forRoutes) {
await this.registerRouteMiddleware(
middlewareContainer,
routeInfo as RouteInfo,
@@ -149,8 +149,7 @@ export class MiddlewareModule {
moduleKey,
applicationRef,
);
};
await Promise.all(forRoutes.map(registerRouteMiddleware));
}
}
public async registerRouteMiddleware(
@@ -163,25 +162,21 @@ export class MiddlewareModule {
const middlewareCollection = [].concat(config.middleware);
const moduleRef = this.container.getModuleByKey(moduleKey);
await Promise.all(
middlewareCollection.map(async (metatype: Type<NestMiddleware>) => {
const collection = middlewareContainer.getMiddlewareCollection(
moduleKey,
);
const instanceWrapper = collection.get(metatype.name);
if (isUndefined(instanceWrapper)) {
throw new RuntimeException();
}
await this.bindHandler(
instanceWrapper,
applicationRef,
routeInfo.method,
routeInfo.path,
moduleRef,
collection,
);
}),
);
for (const metatype of middlewareCollection) {
const collection = middlewareContainer.getMiddlewareCollection(moduleKey);
const instanceWrapper = collection.get(metatype.name);
if (isUndefined(instanceWrapper)) {
throw new RuntimeException();
}
await this.bindHandler(
instanceWrapper,
applicationRef,
routeInfo.method,
routeInfo.path,
moduleRef,
collection,
);
}
}
private async bindHandler(
@@ -273,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

@@ -2,6 +2,7 @@ import {
INestApplicationContext,
Logger,
LoggerService,
LogLevel,
ShutdownSignal,
} from '@nestjs/common';
import { Abstract, Scope } from '@nestjs/common/interfaces';
@@ -78,7 +79,7 @@ export class NestApplicationContext implements INestApplicationContext {
}
public resolve<TInput = any, TResult = TInput>(
typeOrToken: Type<TInput> | string | symbol,
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
contextId = createContextId(),
options: { strict: boolean } = { strict: false },
): Promise<TResult> {
@@ -119,7 +120,7 @@ export class NestApplicationContext implements INestApplicationContext {
this.unsubscribeFromProcessSignals();
}
public useLogger(logger: LoggerService) {
public useLogger(logger: LoggerService | LogLevel[] | false) {
Logger.overrideLogger(logger);
}
@@ -177,7 +178,7 @@ export class NestApplicationContext implements INestApplicationContext {
} catch (err) {
Logger.error(
MESSAGES.ERROR_DURING_SHUTDOWN,
(err as Error).stack,
(err as Error)?.stack,
NestApplicationContext.name,
);
process.exit(1);
@@ -277,7 +278,7 @@ export class NestApplicationContext implements INestApplicationContext {
}
protected async resolvePerContext<TInput = any, TResult = TInput>(
typeOrToken: Type<TInput> | string | symbol,
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
contextModule: Module,
contextId: ContextId,
options?: { strict: boolean },

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';
@@ -40,7 +40,8 @@ const {
/**
* @publicApi
*/
export class NestApplication extends NestApplicationContext
export class NestApplication
extends NestApplicationContext
implements INestApplication {
private readonly logger = new Logger(NestApplication.name, true);
private readonly middlewareModule = new MiddlewareModule();
@@ -163,7 +164,7 @@ export class NestApplication extends NestApplicationContext
await this.registerMiddleware(this.httpAdapter);
const prefix = this.config.getGlobalPrefix();
const basePath = validatePath(prefix);
const basePath = addLeadingSlash(prefix);
this.routesResolver.resolve(this.httpAdapter, basePath);
}
@@ -238,8 +239,8 @@ export class NestApplication extends NestApplicationContext
): 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

@@ -15,6 +15,7 @@ import { ApplicationConfig } from './application-config';
import { MESSAGES } from './constants';
import { ExceptionsZone } from './errors/exceptions-zone';
import { loadAdapter } from './helpers/load-adapter';
import { rethrow } from './helpers/rethrow';
import { NestContainer } from './injector/container';
import { InstanceLoader } from './injector/instance-loader';
import { MetadataScanner } from './metadata-scanner';
@@ -27,6 +28,7 @@ import { DependenciesScanner } from './scanner';
*/
export class NestFactoryStatic {
private readonly logger = new Logger('NestFactory', true);
private abortOnError = true;
/**
* Creates an instance of NestApplication.
*
@@ -67,7 +69,7 @@ export class NestFactoryStatic {
const applicationConfig = new ApplicationConfig();
const container = new NestContainer(applicationConfig);
this.setAbortOnError(serverOrOptions, options);
this.applyLogger(appOptions);
await this.initialize(module, container, applicationConfig, httpServer);
@@ -101,7 +103,7 @@ export class NestFactoryStatic {
);
const applicationConfig = new ApplicationConfig();
const container = new NestContainer(applicationConfig);
this.setAbortOnError(options);
this.applyLogger(options);
await this.initialize(module, container, applicationConfig);
@@ -124,10 +126,9 @@ export class NestFactoryStatic {
options?: NestApplicationContextOptions,
): Promise<INestApplicationContext> {
const container = new NestContainer();
this.setAbortOnError(options);
this.applyLogger(options);
await this.initialize(module, container);
const modules = container.getModules().values();
const root = modules.next().value;
const context = this.createNestInstance<NestApplicationContext>(
@@ -155,17 +156,26 @@ export class NestFactoryStatic {
);
container.setHttpAdapter(httpServer);
const teardown = this.abortOnError === false ? rethrow : undefined;
await httpServer?.init();
try {
this.logger.log(MESSAGES.APPLICATION_START);
await ExceptionsZone.asyncRun(async () => {
await dependenciesScanner.scan(module);
await instanceLoader.createInstancesOfDependencies();
dependenciesScanner.applyApplicationProviders();
});
}, teardown);
} catch (e) {
this.handleInitializationError(e);
}
}
private handleInitializationError(err: unknown) {
if (this.abortOnError) {
process.abort();
}
rethrow(err);
}
private createProxy(target: any) {
@@ -192,11 +202,14 @@ export class NestFactoryStatic {
receiver: Record<string, any>,
prop: string,
): Function {
const teardown = this.abortOnError === false ? rethrow : undefined;
return (...args: unknown[]) => {
let result: unknown;
ExceptionsZone.run(() => {
result = receiver[prop](...args);
});
}, teardown);
return result;
};
}
@@ -225,6 +238,15 @@ export class NestFactoryStatic {
);
}
private setAbortOnError(
serverOrOptions?: AbstractHttpAdapter | NestApplicationOptions,
options?: NestApplicationContextOptions | NestApplicationOptions,
) {
this.abortOnError = this.isHttpServer(serverOrOptions)
? !(options && options.abortOnError === false)
: !(serverOrOptions && serverOrOptions.abortOnError === false);
}
private createAdapterProxy<T>(app: NestApplication, adapter: HttpServer): T {
return (new Proxy(app, {
get: (receiver: Record<string, any>, prop: string) => {

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "7.4.4",
"version": "7.5.5",
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
"author": "Kamil Mysliwiec",
"license": "MIT",
@@ -27,16 +27,16 @@
}
},
"dependencies": {
"@nuxtjs/opencollective": "0.2.2",
"@nuxtjs/opencollective": "0.3.2",
"fast-safe-stringify": "2.0.7",
"iterare": "1.2.1",
"object-hash": "2.0.3",
"path-to-regexp": "3.2.0",
"tslib": "2.0.1",
"uuid": "8.3.0"
"tslib": "2.0.3",
"uuid": "8.3.1"
},
"devDependencies": {
"@nestjs/common": "7.4.4"
"@nestjs/common": "7.5.5"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",

View File

@@ -13,19 +13,24 @@ import {
REDIRECT_METADATA,
RENDER_METADATA,
ROUTE_ARGS_METADATA,
SSE_METADATA,
} from '@nestjs/common/constants';
import { RouteParamMetadata } from '@nestjs/common/decorators';
import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum';
import { ContextType, Controller } from '@nestjs/common/interfaces';
import { isEmpty, isString } from '@nestjs/common/utils/shared.utils';
import { IncomingMessage } from 'http';
import { Observable } from 'rxjs';
import { FORBIDDEN_MESSAGE } from '../guards/constants';
import { GuardsConsumer } from '../guards/guards-consumer';
import { GuardsContextCreator } from '../guards/guards-context-creator';
import { ContextUtils } from '../helpers/context-utils';
import { ExecutionContextHost } from '../helpers/execution-context-host';
import {
HandleResponseFn,
HandlerMetadata,
HandlerMetadataStorage,
HandlerResponseBasicFn,
} from '../helpers/handler-metadata-storage';
import { STATIC_CONTEXT } from '../injector/constants';
import { InterceptorsConsumer } from '../interceptors/interceptors-consumer';
@@ -38,6 +43,7 @@ import {
RedirectResponse,
RouterResponseController,
} from './router-response-controller';
import { HeaderStream } from './sse-stream';
export interface ParamProperties {
index: number;
@@ -160,7 +166,7 @@ export class RouterExecutionContext {
handler(args, req, res, next),
contextType,
);
await fnHandleResponse(result, res);
await (fnHandleResponse as HandlerResponseBasicFn)(result, res, req);
};
}
@@ -209,9 +215,10 @@ export class RouterExecutionContext {
);
const paramsMetadata = getParamsMetadata(moduleKey);
const isResponseHandled = paramsMetadata.some(
({ type }) =>
type === RouteParamtypes.RESPONSE || type === RouteParamtypes.NEXT,
const isResponseHandled = this.isResponseHandled(
instance,
methodName,
paramsMetadata,
);
const httpRedirectResponse = this.reflectRedirect(callback);
@@ -265,6 +272,10 @@ export class RouterExecutionContext {
return Reflect.getMetadata(HEADERS_METADATA, callback) || [];
}
public reflectSse(callback: (...args: unknown[]) => unknown): string {
return Reflect.getMetadata(SSE_METADATA, callback);
}
public exchangeKeysForValues(
keys: string[],
metadata: Record<number, RouteParamMetadata>,
@@ -398,7 +409,7 @@ export class RouterExecutionContext {
isResponseHandled: boolean,
redirectResponse?: RedirectResponse,
httpStatusCode?: number,
) {
): HandleResponseFn {
const renderTemplate = this.reflectRenderTemplate(callback);
if (renderTemplate) {
return async <TResult, TResponse>(result: TResult, res: TResponse) => {
@@ -410,10 +421,44 @@ export class RouterExecutionContext {
await this.responseController.redirect(result, res, redirectResponse);
};
}
const isSseHandler = !!this.reflectSse(callback);
if (isSseHandler) {
return async <
TResult extends Observable<unknown> = any,
TResponse extends HeaderStream = any,
TRequest extends IncomingMessage = any
>(
result: TResult,
res: TResponse,
req: TRequest,
) => {
await this.responseController.sse(
result,
(res as any).raw || res,
(req as any).raw || req,
);
};
}
return async <TResult, TResponse>(result: TResult, res: TResponse) => {
result = await this.responseController.transformToResult(result);
!isResponseHandled &&
(await this.responseController.apply(result, res, httpStatusCode));
};
}
private isResponseHandled(
instance: Controller,
methodName: string,
paramsMetadata: ParamProperties[],
): boolean {
const hasResponseOrNextDecorator = paramsMetadata.some(
({ type }) =>
type === RouteParamtypes.RESPONSE || type === RouteParamtypes.NEXT,
);
const isPassthroughEnabled = this.contextUtils.reflectPassthrough(
instance,
methodName,
);
return hasResponseOrNextDecorator && !isPassthroughEnabled;
}
}

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

@@ -1,5 +1,9 @@
import { HttpServer, HttpStatus, RequestMethod } from '@nestjs/common';
import { isFunction } from '@nestjs/common/utils/shared.utils';
import { isFunction, isObject } from '@nestjs/common/utils/shared.utils';
import { IncomingMessage } from 'http';
import { Observable } from 'rxjs';
import { debounce } from 'rxjs/operators';
import { HeaderStream, SseStream } from './sse-stream';
export interface CustomHeader {
name: string;
@@ -78,4 +82,42 @@ export class RouterResponseController {
) {
this.applicationRef.status(response, statusCode);
}
public async sse<
TInput extends Observable<unknown> = any,
TResponse extends HeaderStream = any,
TRequest extends IncomingMessage = any
>(result: TInput, response: TResponse, request: TRequest) {
this.assertObservable(result);
const stream = new SseStream(request);
stream.pipe(response);
const subscription = result
.pipe(
debounce(
(message: any) =>
new Promise(resolve => {
if (!isObject(message)) {
message = { data: message };
}
stream.writeMessage(message, resolve);
}),
),
)
.subscribe();
request.on('close', () => {
response.end();
subscription.unsubscribe();
});
}
private assertObservable(result: any) {
if (!isFunction(result.subscribe)) {
throw new ReferenceError(
'You must return an Observable stream to use Server-Sent Events (SSE).',
);
}
}
}

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

@@ -0,0 +1,107 @@
import { MessageEvent } from '@nestjs/common/interfaces';
import { IncomingMessage, OutgoingHttpHeaders } from 'http';
import { Transform } from 'stream';
function toDataString(data: string | object): string {
if (typeof data === 'object') {
return toDataString(JSON.stringify(data));
}
return data
.split(/\r\n|\r|\n/)
.map(line => `data: ${line}\n`)
.join('');
}
interface WriteHeaders {
writeHead?(
statusCode: number,
reasonPhrase?: string,
headers?: OutgoingHttpHeaders,
): void;
writeHead?(statusCode: number, headers?: OutgoingHttpHeaders): void;
flushHeaders?(): void;
}
export type HeaderStream = NodeJS.WritableStream & WriteHeaders;
/**
* Adapted from https://raw.githubusercontent.com/EventSource/node-ssestream
* Transforms "messages" to W3C event stream content.
* See https://html.spec.whatwg.org/multipage/server-sent-events.html
* A message is an object with one or more of the following properties:
* - data (String or object, which gets turned into JSON)
* - type
* - id
* - retry
*
* If constructed with a HTTP Request, it will optimise the socket for streaming.
* If this stream is piped to an HTTP Response, it will set appropriate headers.
*/
export class SseStream extends Transform {
private lastEventId: number = null;
constructor(req?: IncomingMessage) {
super({ objectMode: true });
if (req && req.socket) {
req.socket.setKeepAlive(true);
req.socket.setNoDelay(true);
req.socket.setTimeout(0);
}
}
pipe<T extends HeaderStream>(destination: T, options?: { end?: boolean }): T {
if (destination.writeHead) {
destination.writeHead(200, {
// See https://github.com/dunglas/mercure/blob/master/hub/subscribe.go#L124-L130
'Content-Type': 'text/event-stream',
Connection: 'keep-alive',
// Disable cache, even for old browsers and proxies
'Cache-Control':
'private, no-cache, no-store, must-revalidate, max-age=0, no-transform',
'Transfer-Encoding': 'identity',
Pragma: 'no-cache',
Expire: '0',
// NGINX support https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/#x-accel-buffering
'X-Accel-Buffering': 'no',
});
destination.flushHeaders();
}
destination.write(':\n');
return super.pipe(destination, options);
}
_transform(
message: MessageEvent,
encoding: string,
callback: (error?: Error | null, data?: any) => void,
) {
let data = message.type ? `event: ${message.type}\n` : '';
data += message.id ? `id: ${message.id}\n` : '';
data += message.retry ? `retry: ${message.retry}\n` : '';
data += message.data ? toDataString(message.data) : '';
data += '\n';
this.push(data);
callback();
}
/**
* Calls `.write` but handles the drain if needed
*/
writeMessage(
message: MessageEvent,
cb: (error: Error | null | undefined) => void,
) {
if (!message.id) {
this.lastEventId++;
message.id = this.lastEventId.toString();
}
if (!this.write(message, 'utf-8', cb)) {
this.once('drain', cb);
} else {
process.nextTick(cb);
}
}
}

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

@@ -1,6 +1,8 @@
import { ForbiddenException } from '@nestjs/common/exceptions/forbidden.exception';
import { expect } from 'chai';
import { of } from 'rxjs';
import * as sinon from 'sinon';
import { PassThrough } from 'stream';
import { HttpException, HttpStatus, RouteParamMetadata } from '../../../common';
import { CUSTOM_ROUTE_AGRS_METADATA } from '../../../common/constants';
import { RouteParamtypes } from '../../../common/enums/route-paramtypes.enum';
@@ -9,6 +11,7 @@ import { ApplicationConfig } from '../../application-config';
import { FORBIDDEN_MESSAGE } from '../../guards/constants';
import { GuardsConsumer } from '../../guards/guards-consumer';
import { GuardsContextCreator } from '../../guards/guards-context-creator';
import { HandlerResponseBasicFn } from '../../helpers/handler-metadata-storage';
import { NestContainer } from '../../injector/container';
import { InterceptorsConsumer } from '../../interceptors/interceptors-consumer';
import { InterceptorsContextCreator } from '../../interceptors/interceptors-context-creator';
@@ -313,7 +316,7 @@ describe('RouterExecutionContext', () => {
true,
undefined,
200,
);
) as HandlerResponseBasicFn;
await handler(value, response);
expect(response.render.calledWith(template, value)).to.be.true;
@@ -326,13 +329,14 @@ describe('RouterExecutionContext', () => {
sinon.stub(contextCreator, 'reflectResponseHeaders').returns([]);
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
sinon.stub(contextCreator, 'reflectSse').returns(undefined);
const handler = contextCreator.createHandleResponseFn(
null,
true,
undefined,
200,
);
) as HandlerResponseBasicFn;
await handler(result, response);
expect(response.render.called).to.be.false;
@@ -358,7 +362,7 @@ describe('RouterExecutionContext', () => {
true,
redirectResponse,
200,
);
) as HandlerResponseBasicFn;
await handler(redirectResponse, response);
expect(
@@ -377,13 +381,14 @@ describe('RouterExecutionContext', () => {
sinon.stub(contextCreator, 'reflectResponseHeaders').returns([]);
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
sinon.stub(contextCreator, 'reflectSse').returns(undefined);
const handler = contextCreator.createHandleResponseFn(
null,
true,
undefined,
200,
);
) as HandlerResponseBasicFn;
await handler(result, response);
expect(response.redirect.called).to.be.false;
@@ -396,13 +401,14 @@ describe('RouterExecutionContext', () => {
const response = {};
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
sinon.stub(contextCreator, 'reflectSse').returns(undefined);
const handler = contextCreator.createHandleResponseFn(
null,
false,
undefined,
1234,
);
) as HandlerResponseBasicFn;
const adapterReplySpy = sinon.spy(adapter, 'reply');
await handler(result, response);
expect(
@@ -414,5 +420,54 @@ describe('RouterExecutionContext', () => {
).to.be.true;
});
});
describe('when "isSse" is enabled', () => {
it('should delegate result to SseStream', async () => {
const result = of('test');
const response = new PassThrough();
response.write = sinon.spy();
const request = new PassThrough();
request.on = sinon.spy();
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
sinon.stub(contextCreator, 'reflectSse').returns('/');
const handler = contextCreator.createHandleResponseFn(
null,
true,
undefined,
200,
) as HandlerResponseBasicFn;
await handler(result, response, request);
expect((response.write as any).called).to.be.true;
expect((request.on as any).called).to.be.true;
});
it('should not allow a non-observable result', async () => {
const result = Promise.resolve('test');
const response = new PassThrough();
const request = new PassThrough();
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
sinon.stub(contextCreator, 'reflectSse').returns('/');
const handler = contextCreator.createHandleResponseFn(
null,
true,
undefined,
200,
) as HandlerResponseBasicFn;
try {
await handler(result, response, request);
} catch (e) {
expect(e.message).to.equal(
'You must return an Observable stream to use Server-Sent Events (SSE).',
);
}
});
});
});
});

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

@@ -1,8 +1,10 @@
import { isNil, isObject } from '@nestjs/common/utils/shared.utils';
import { expect } from 'chai';
import { IncomingMessage, ServerResponse } from 'http';
import { of } from 'rxjs';
import * as sinon from 'sinon';
import { RequestMethod, HttpStatus } from '../../../common';
import { PassThrough, Writable } from 'stream';
import { HttpStatus, RequestMethod } from '../../../common';
import { RouterResponseController } from '../../router/router-response-controller';
import { NoopHttpAdapter } from '../utils/noop-adapter.spec';
@@ -247,4 +249,79 @@ describe('RouterResponseController', () => {
});
});
});
describe('Server-Sent-Events', () => {
it('should accept only observables', async () => {
const result = Promise.resolve('test');
try {
await routerResponseController.sse(
(result as unknown) as any,
({} as unknown) as ServerResponse,
({} as unknown) as IncomingMessage,
);
} catch (e) {
expect(e.message).to.eql(
'You must return an Observable stream to use Server-Sent Events (SSE).',
);
}
});
it('should write string', async () => {
class Sink extends Writable {
private readonly chunks: string[] = [];
_write(
chunk: any,
encoding: string,
callback: (error?: Error | null) => void,
): void {
this.chunks.push(chunk);
callback();
}
get content() {
return this.chunks.join('');
}
}
const written = (stream: Writable) =>
new Promise((resolve, reject) =>
stream.on('error', reject).on('finish', resolve),
);
const result = of('test');
const response = new Sink();
const request = new PassThrough();
routerResponseController.sse(
result,
(response as unknown) as ServerResponse,
(request as unknown) as IncomingMessage,
);
request.destroy();
await written(response);
expect(response.content).to.eql(
`:
id: 1
data: test
`,
);
});
it('should close on request close', done => {
const result = of('test');
const response = new Writable();
response.end = () => done();
response._write = () => {};
const request = new Writable();
request._write = () => {};
routerResponseController.sse(
result,
(response as unknown) as ServerResponse,
(request as unknown) as IncomingMessage,
);
request.emit('close');
});
});
});

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

@@ -0,0 +1,160 @@
import { expect } from 'chai';
import * as EventSource from 'eventsource';
import { createServer, OutgoingHttpHeaders } from 'http';
import { AddressInfo } from 'net';
import { Writable } from 'stream';
import { HeaderStream, SseStream } from '../../router/sse-stream';
const noop = () => {};
const written = (stream: Writable) =>
new Promise((resolve, reject) =>
stream.on('error', reject).on('finish', resolve),
);
class Sink extends Writable implements HeaderStream {
private readonly chunks: string[] = [];
constructor(
public readonly writeHead?: (
statusCode: number,
headers?: OutgoingHttpHeaders | string,
) => void,
) {
super({ objectMode: true });
}
_write(
chunk: any,
encoding: string,
callback: (error?: Error | null) => void,
): void {
this.chunks.push(chunk);
callback();
}
get content() {
return this.chunks.join('');
}
}
describe('SseStream', () => {
it('writes multiple multiline messages', async () => {
const sse = new SseStream();
const sink = new Sink();
sse.pipe(sink);
sse.writeMessage(
{
data: 'hello\nworld',
},
noop,
);
sse.writeMessage(
{
data: 'bonjour\nmonde',
},
noop,
);
sse.end();
await written(sink);
expect(sink.content).to.equal(
`:
id: 1
data: hello
data: world
id: 2
data: bonjour
data: monde
`,
);
});
it('writes object messages as JSON', async () => {
const sse = new SseStream();
const sink = new Sink();
sse.pipe(sink);
sse.writeMessage(
{
data: { hello: 'world' },
},
noop,
);
sse.end();
await written(sink);
expect(sink.content).to.equal(
`:
id: 1
data: {"hello":"world"}
`,
);
});
it('writes all message attributes', async () => {
const sse = new SseStream();
const sink = new Sink();
sse.pipe(sink);
sse.writeMessage(
{
type: 'tea-time',
id: 'the-id',
retry: 222,
data: 'hello',
},
noop,
);
sse.end();
await written(sink);
expect(sink.content).to.equal(
`:
event: tea-time
id: the-id
retry: 222
data: hello
`,
);
});
it('sets headers on destination when it looks like a HTTP Response', callback => {
const sse = new SseStream();
const sink = new Sink((status: number, headers: OutgoingHttpHeaders) => {
expect(headers).to.deep.equal({
'Content-Type': 'text/event-stream',
Connection: 'keep-alive',
'Cache-Control':
'private, no-cache, no-store, must-revalidate, max-age=0',
'Transfer-Encoding': 'identity',
Pragma: 'no-cache',
Expire: '0',
'X-Accel-Buffering': 'no',
});
callback();
return sink;
});
sse.pipe(sink);
});
it('allows an eventsource to connect', callback => {
let sse: SseStream;
const server = createServer((req, res) => {
sse = new SseStream(req);
sse.pipe(res);
});
server.listen(() => {
const es = new EventSource(
`http://localhost:${(server.address() as AddressInfo).port}`,
);
es.onmessage = e => {
expect(e.data).to.equal('hello');
es.close();
server.close(callback);
};
es.onopen = () => sse.writeMessage({ data: 'hello' }, noop);
es.onerror = e =>
callback(new Error(`Error from EventSource: ${JSON.stringify(e)}`));
});
});
});

View File

@@ -66,7 +66,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
#### Sponsors
@@ -84,12 +85,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
<td align="center" valign="middle">
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" 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/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/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
</tr></table>
## Backers

View File

@@ -11,6 +11,7 @@ import { KafkaHeaders } from '../enums';
import { InvalidKafkaClientTopicPartitionException } from '../errors/invalid-kafka-client-topic-partition.exception';
import { InvalidKafkaClientTopicException } from '../errors/invalid-kafka-client-topic.exception';
import {
BrokersFunction,
Consumer,
ConsumerConfig,
ConsumerGroupJoinEvent,
@@ -47,7 +48,7 @@ export class ClientKafka extends ClientProxy {
protected responsePatterns: string[] = [];
protected consumerAssignments: { [key: string]: number[] } = {};
protected brokers: string[];
protected brokers: string[] | BrokersFunction;
protected clientId: string;
protected groupId: string;
@@ -64,8 +65,11 @@ export class ClientKafka extends ClientProxy {
// Append a unique id to the clientId and groupId
// so they don't collide with a microservices client
this.clientId =
(clientOptions.clientId || KAFKA_DEFAULT_CLIENT) + '-client';
this.groupId = (consumerOptions.groupId || KAFKA_DEFAULT_GROUP) + '-client';
(clientOptions.clientId || KAFKA_DEFAULT_CLIENT) +
(clientOptions.clientIdPostfix || '-client');
this.groupId =
(consumerOptions.groupId || KAFKA_DEFAULT_GROUP) +
(clientOptions.clientIdPostfix || '-client');
kafkaPackage = loadPackage('kafkajs', ClientKafka.name, () =>
require('kafkajs'),
@@ -80,9 +84,9 @@ export class ClientKafka extends ClientProxy {
this.responsePatterns.push(this.getResponsePatternName(request));
}
public close(): void {
this.producer && this.producer.disconnect();
this.consumer && this.consumer.disconnect();
public async close(): Promise<void> {
this.producer && (await this.producer.disconnect());
this.consumer && (await this.consumer.disconnect());
this.producer = null;
this.consumer = null;
this.client = null;

View File

@@ -10,6 +10,7 @@ import {
ERROR_EVENT,
RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT,
RQM_DEFAULT_NOACK,
RQM_DEFAULT_PERSISTENT,
RQM_DEFAULT_PREFETCH_COUNT,
RQM_DEFAULT_QUEUE,
RQM_DEFAULT_QUEUE_OPTIONS,
@@ -17,6 +18,7 @@ import {
} from '../constants';
import { ReadPacket, RmqOptions, WritePacket } from '../interfaces';
import { ClientProxy } from './client-proxy';
import { RmqUrl } from '../external/rmq-url.interface';
let rqmPackage: any = {};
@@ -27,11 +29,12 @@ export class ClientRMQ extends ClientProxy {
protected connection: Promise<any>;
protected client: any = null;
protected channel: any = null;
protected urls: string[];
protected urls: string[] | RmqUrl[];
protected queue: string;
protected queueOptions: any;
protected responseEmitter: EventEmitter;
protected replyQueue: string;
protected persistent: boolean;
constructor(protected readonly options: RmqOptions['options']) {
super();
@@ -43,6 +46,8 @@ export class ClientRMQ extends ClientProxy {
RQM_DEFAULT_QUEUE_OPTIONS;
this.replyQueue =
this.getOptionsProp(this.options, 'replyQueue') || REPLY_QUEUE;
this.persistent =
this.getOptionsProp(this.options, 'persistent') || RQM_DEFAULT_PERSISTENT;
loadPackage('amqplib', ClientRMQ.name, () => require('amqplib'));
rqmPackage = loadPackage('amqp-connection-manager', ClientRMQ.name, () =>
require('amqp-connection-manager'),
@@ -187,6 +192,7 @@ export class ClientRMQ extends ClientProxy {
{
replyTo: this.replyQueue,
correlationId,
persistent: this.persistent,
},
);
return () => this.responseEmitter.removeListener(correlationId, listener);
@@ -202,7 +208,9 @@ export class ClientRMQ extends ClientProxy {
this.channel.sendToQueue(
this.queue,
Buffer.from(JSON.stringify(serializedPacket)),
{},
{
persistent: this.persistent,
},
err => (err ? reject(err) : resolve()),
),
);

View File

@@ -33,6 +33,7 @@ export const RQM_DEFAULT_PREFETCH_COUNT = 0;
export const RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT = false;
export const RQM_DEFAULT_QUEUE_OPTIONS = {};
export const RQM_DEFAULT_NOACK = true;
export const RQM_DEFAULT_PERSISTENT = false;
export const GRPC_DEFAULT_PROTO_LOADER = '@grpc/proto-loader';
export const NO_MESSAGE_HANDLER = `There is no matching message handler defined in the remote service.`;

View File

@@ -5,5 +5,6 @@ export const DEFAULT_CALLBACK_METADATA = {
};
export const DEFAULT_GRPC_CALLBACK_METADATA = {
[`${RpcParamtype.CONTEXT}:1`]: { index: 1, data: undefined, pipes: [] },
[`${RpcParamtype.GRPC_CALL}:2`]: { index: 2, data: undefined, pipes: [] },
...DEFAULT_CALLBACK_METADATA,
};

View File

@@ -6,6 +6,7 @@ export enum KafkaHeaders {
BATCH_CONVERTED_HEADERS = 'kafka_batchConvertedHeaders',
CONSUMER = 'kafka_consumer',
CORRELATION_ID = 'kafka_correlationId',
DELIVERY_ATTEMPT = 'kafka_deliveryAttempt',
DLT_EXCEPTION_FQCN = 'kafka_dlt-exception-fqcn',
DLT_EXCEPTION_MESSAGE = 'kafka_dlt-exception-message',
DLT_EXCEPTION_STACKTRACE = 'kafka_dlt-exception-stacktrace',
@@ -14,6 +15,7 @@ export enum KafkaHeaders {
DLT_ORIGINAL_TIMESTAMP = 'kafka_dlt-original-timestamp',
DLT_ORIGINAL_TIMESTAMP_TYPE = 'kafka_dlt-original-timestamp-type',
DLT_ORIGINAL_TOPIC = 'kafka_dlt-original-topic',
GROUP_ID = 'kafka_groupId',
MESSAGE_KEY = 'kafka_messageKey',
NATIVE_HEADERS = 'kafka_nativeHeaders',
OFFSET = 'kafka_offset',

View File

@@ -1,4 +1,5 @@
export enum RpcParamtype {
PAYLOAD = 3,
CONTEXT = 6,
GRPC_CALL = 9,
}

View File

@@ -1,7 +1,12 @@
/// <reference types="node" />
import * as tls from 'tls';
import * as net from 'net';
import * as tls from 'tls';
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type XOR<T, U> = T | U extends object
? (Without<T, U> & U) | (Without<U, T> & T)
: T | U;
export declare class Kafka {
constructor(config: KafkaConfig);
@@ -11,13 +16,17 @@ export declare class Kafka {
logger(): Logger;
}
export type BrokersFunction = () => string[] | Promise<string[]>;
export interface KafkaConfig {
brokers: string[];
brokers: string[] | BrokersFunction;
ssl?: tls.ConnectionOptions | boolean;
sasl?: SASLOptions;
clientId?: string;
clientIdPostfix?: string;
connectionTimeout?: number;
authenticationTimeout?: number;
reauthenticationThreshold?: number;
requestTimeout?: number;
enforceRequestTimeout?: boolean;
retry?: RetryOptions;
@@ -33,8 +42,10 @@ export type ISocketFactory = (
onConnect: () => void,
) => net.Socket;
export type SASLMechanism = 'plain' | 'scram-sha-256' | 'scram-sha-512' | 'aws';
export interface SASLOptions {
mechanism: 'plain' | 'scram-sha-256' | 'scram-sha-512' | 'aws';
mechanism: SASLMechanism;
username: string;
password: string;
}
@@ -65,24 +76,25 @@ export interface PartitionerArgs {
}
export type ICustomPartitioner = () => (args: PartitionerArgs) => number;
export type DefaultPartitioner = (args: PartitionerArgs) => number;
export type JavaCompatiblePartitioner = (args: PartitionerArgs) => number;
export type DefaultPartitioner = ICustomPartitioner;
export type JavaCompatiblePartitioner = ICustomPartitioner;
export let Partitioners: {
DefaultPartitioner: DefaultPartitioner;
JavaCompatiblePartitioner: JavaCompatiblePartitioner;
};
export interface PartitionMetadata {
export type PartitionMetadata = {
partitionErrorCode: number;
partitionId: number;
leader: number;
replicas: number[];
isr: number[];
}
offlineReplicas?: number[];
};
export interface IHeaders {
[key: string]: Buffer;
[key: string]: Buffer | string;
}
export interface ConsumerConfig {
@@ -96,15 +108,16 @@ export interface ConsumerConfig {
minBytes?: number;
maxBytes?: number;
maxWaitTimeInMs?: number;
retry?: RetryOptions;
retry?: RetryOptions & {
restartOnFailure?: (err: Error) => Promise<boolean>;
};
allowAutoTopicCreation?: boolean;
maxInFlightRequests?: number;
readUncommitted?: boolean;
rackId?: string;
}
export interface PartitionAssigner {
new (config: { cluster: Cluster }): Assigner;
}
export type PartitionAssigner = (config: { cluster: Cluster }) => Assigner;
export interface CoordinatorMetadata {
errorCode: number;
@@ -115,7 +128,7 @@ export interface CoordinatorMetadata {
};
}
export interface Cluster {
export type Cluster = {
isConnected(): boolean;
connect(): Promise<void>;
disconnect(): Promise<void>;
@@ -135,46 +148,38 @@ export interface Cluster {
}): Promise<CoordinatorMetadata>;
defaultOffset(config: { fromBeginning: boolean }): number;
fetchTopicsOffset(
topics: Array<{
topic: string;
partitions: Array<{ partition: number }>;
fromBeginning: boolean;
}>,
topics: Array<
{
topic: string;
partitions: Array<{ partition: number }>;
} & XOR<{ fromBeginning: boolean }, { fromTimestamp: number }>
>,
): Promise<{
topic: string;
partitions: Array<{ partition: number; offset: string }>;
}>;
}
};
export interface Assignment {
[topic: string]: number[];
}
export type Assignment = { [topic: string]: number[] };
export interface GroupMember {
memberId: string;
memberMetadata: MemberMetadata;
}
export type GroupMember = { memberId: string; memberMetadata: Buffer };
export interface GroupMemberAssignment {
export type GroupMemberAssignment = {
memberId: string;
memberAssignment: Buffer;
}
};
export interface GroupState {
name: string;
metadata: Buffer;
}
export type GroupState = { name: string; metadata: Buffer };
export interface Assigner {
export type Assigner = {
name: string;
version: number;
assign(group: {
members: GroupMember[];
topics: string[];
userData: Buffer;
}): Promise<GroupMemberAssignment[]>;
protocol(subscription: { topics: string[]; userData: Buffer }): GroupState;
}
protocol(subscription: { topics: string[] }): GroupState;
};
export interface RetryOptions {
maxRetryTime?: number;
@@ -196,12 +201,18 @@ export interface ITopicConfig {
configEntries?: object[];
}
export interface ITopicPartitionConfig {
topic: string;
count: number;
assignments?: Array<Array<number>>;
}
export interface ITopicMetadata {
name: string;
partitions: PartitionMetadata[];
}
export enum ResourceType {
export enum ResourceTypes {
UNKNOWN = 0,
ANY = 1,
TOPIC = 2,
@@ -212,9 +223,9 @@ export enum ResourceType {
}
export interface ResourceConfigQuery {
type: ResourceType;
type: ResourceTypes;
name: string;
configNames: string[];
configNames?: string[];
}
export interface ConfigEntries {
@@ -238,26 +249,26 @@ export interface DescribeConfigResponse {
errorCode: number;
errorMessage: string;
resourceName: string;
resourceType: ResourceType;
resourceType: ResourceTypes;
}[];
throttleTime: number;
}
export interface IResourceConfig {
type: ResourceType;
type: ResourceTypes;
name: string;
configEntries: { name: string; value: string }[];
}
type ValueOf<T> = T[keyof T];
export interface AdminEvents {
export type AdminEvents = {
CONNECT: 'admin.connect';
DISCONNECT: 'admin.disconnect';
REQUEST: 'admin.network.request';
REQUEST_TIMEOUT: 'admin.network.request_timeout';
REQUEST_QUEUE_SIZE: 'admin.network.request_queue_size';
}
};
export interface InstrumentationEvent<T> {
id: string;
@@ -266,6 +277,8 @@ export interface InstrumentationEvent<T> {
payload: T;
}
export type RemoveInstrumentationEventListener<T> = () => void;
export type ConnectEvent = InstrumentationEvent<null>;
export type DisconnectEvent = InstrumentationEvent<null>;
export type RequestEvent = InstrumentationEvent<{
@@ -303,9 +316,10 @@ export interface SeekEntry {
offset: string;
}
export interface Admin {
export type Admin = {
connect(): Promise<void>;
disconnect(): Promise<void>;
listTopics(): Promise<string[]>;
createTopics(options: {
validateOnly?: boolean;
waitForLeaders?: boolean;
@@ -313,20 +327,30 @@ export interface Admin {
topics: ITopicConfig[];
}): Promise<boolean>;
deleteTopics(options: { topics: string[]; timeout?: number }): Promise<void>;
fetchTopicMetadata(options: {
createPartitions(options: {
validateOnly?: boolean;
timeout?: number;
topicPartitions: ITopicPartitionConfig[];
}): Promise<boolean>;
fetchTopicMetadata(options?: {
topics: string[];
}): Promise<{ topics: Array<ITopicMetadata> }>;
fetchOffsets(options: {
groupId: string;
topic: string;
}): Promise<
Array<{ partition: number; offset: string; metadata: string | null }>
>;
}): Promise<Array<SeekEntry & { metadata: string | null }>>;
fetchTopicOffsets(
topic: string,
): Promise<
Array<{ partition: number; offset: string; high: string; low: string }>
>;
): Promise<Array<SeekEntry & { high: string; low: string }>>;
fetchTopicOffsetsByTimestamp(
topic: string,
timestamp?: number,
): Promise<Array<SeekEntry>>;
describeCluster(): Promise<{
brokers: Array<{ nodeId: number; host: string; port: number }>;
controller: number | null;
clusterId: string;
}>;
setOffsets(options: {
groupId: string;
topic: string;
@@ -345,29 +369,35 @@ export interface Admin {
validateOnly: boolean;
resources: IResourceConfig[];
}): Promise<any>;
listGroups(): Promise<{ groups: GroupOverview[] }>;
deleteGroups(groupIds: string[]): Promise<DeleteGroupsResult[]>;
describeGroups(groupIds: string[]): Promise<GroupDescriptions>;
logger(): Logger;
on(eventName: ValueOf<AdminEvents>, listener: (...args: any[]) => void): void;
on(
eventName: ValueOf<AdminEvents>,
listener: (...args: any[]) => void,
): RemoveInstrumentationEventListener<typeof eventName>;
events: AdminEvents;
}
};
export let PartitionAssigners: { roundRobin: PartitionAssigner };
export interface ISerializer<T> {
encode(value: T): Buffer;
decode(buffer: Buffer): T;
decode(buffer: Buffer): T | null;
}
export interface MemberMetadata {
export type MemberMetadata = {
version: number;
topics: string[];
userData: Buffer;
}
};
export interface MemberAssignment {
export type MemberAssignment = {
version: number;
assignment: Assignment;
userData: Buffer;
}
};
export let AssignerProtocol: {
MemberMetadata: ISerializer<MemberMetadata>;
@@ -395,11 +425,16 @@ export interface LoggerEntryContent {
[key: string]: any;
}
export type Logger = (entry: LogEntry) => void;
export type logCreator = (logLevel: logLevel) => (entry: LogEntry) => void;
export type logCreator = (logLevel: string) => (entry: LogEntry) => void;
export type Logger = {
info: (message: string, extra?: object) => void;
error: (message: string, extra?: object) => void;
warn: (message: string, extra?: object) => void;
debug: (message: string, extra?: object) => void;
};
export interface Broker {
export type Broker = {
isConnected(): boolean;
connect(): Promise<void>;
disconnect(): Promise<void>;
@@ -409,7 +444,12 @@ export interface Broker {
metadata(
topics: string[],
): Promise<{
brokers: Array<{ nodeId: number; host: string; port: number }>;
brokers: Array<{
nodeId: number;
host: string;
port: number;
rack?: string;
}>;
topicMetadata: Array<{
topicErrorCode: number;
topic: number;
@@ -426,17 +466,33 @@ export interface Broker {
partitions: Array<{ partition: number; offset: string }>;
}>;
}): Promise<any>;
}
fetch(request: {
replicaId?: number;
isolationLevel?: number;
maxWaitTime?: number;
minBytes?: number;
maxBytes?: number;
topics: Array<{
topic: string;
partitions: Array<{
partition: number;
fetchOffset: string;
maxBytes: number;
}>;
}>;
rackId?: string;
}): Promise<any>;
};
export interface KafkaMessage {
export type KafkaMessage = {
key: Buffer;
value: Buffer;
value: Buffer | null;
timestamp: string;
size: number;
attributes: number;
offset: string;
headers?: IHeaders;
}
};
export interface ProducerRecord {
topic: string;
@@ -446,13 +502,13 @@ export interface ProducerRecord {
compression?: CompressionTypes;
}
export interface RecordMetadata {
export type RecordMetadata = {
topicName: string;
partition: number;
errorCode: number;
offset: string;
timestamp: string;
}
};
export interface TopicMessages {
topic: string;
@@ -460,10 +516,10 @@ export interface TopicMessages {
}
export interface ProducerBatch {
acks: number;
timeout: number;
compression: CompressionTypes;
topicMessages: TopicMessages[];
acks?: number;
timeout?: number;
compression?: CompressionTypes;
topicMessages?: TopicMessages[];
}
export interface PartitionOffset {
@@ -480,18 +536,18 @@ export interface Offsets {
topics: TopicOffsets[];
}
interface Sender {
type Sender = {
send(record: ProducerRecord): Promise<RecordMetadata[]>;
sendBatch(batch: ProducerBatch): Promise<RecordMetadata[]>;
}
};
export interface ProducerEvents {
export type ProducerEvents = {
CONNECT: 'producer.connect';
DISCONNECT: 'producer.disconnect';
REQUEST: 'producer.network.request';
REQUEST_TIMEOUT: 'producer.network.request_timeout';
REQUEST_QUEUE_SIZE: 'producer.network.request_queue_size';
}
};
export type Producer = Sender & {
connect(): Promise<void>;
@@ -501,7 +557,7 @@ export type Producer = Sender & {
on(
eventName: ValueOf<ProducerEvents>,
listener: (...args: any[]) => void,
): void;
): RemoveInstrumentationEventListener<typeof eventName>;
transaction(): Promise<Transaction>;
logger(): Logger;
};
@@ -513,41 +569,45 @@ export type Transaction = Sender & {
isActive(): boolean;
};
export interface ConsumerGroup {
export type ConsumerGroup = {
groupId: string;
generationId: number;
memberId: string;
coordinator: Broker;
}
};
export interface MemberDescription {
export type MemberDescription = {
clientHost: string;
clientId: string;
memberId: string;
memberAssignment: Buffer;
memberMetadata: Buffer;
}
};
export interface GroupDescription {
export type GroupDescription = {
groupId: string;
members: MemberDescription[];
protocol: string;
protocolType: string;
state: string;
}
};
export interface TopicPartitions {
topic: string;
partitions: number[];
}
export interface TopicPartitionOffsetAndMedata {
export type GroupDescriptions = {
groups: GroupDescription[];
};
export type TopicPartitions = { topic: string; partitions: number[] };
export type TopicPartitionOffsetAndMetadata = {
topic: string;
partition: number;
offset: string;
metadata?: string | null;
}
};
export interface Batch {
// TODO: Remove with 2.x
export type TopicPartitionOffsetAndMedata = TopicPartitionOffsetAndMetadata;
export type Batch = {
topic: string;
partition: number;
highWatermark: string;
@@ -557,12 +617,23 @@ export interface Batch {
lastOffset(): string;
offsetLag(): string;
offsetLagLow(): string;
}
};
export interface ConsumerEvents {
export type GroupOverview = {
groupId: string;
protocolType: string;
};
export type DeleteGroupsResult = {
groupId: string;
errorCode?: number;
};
export type ConsumerEvents = {
HEARTBEAT: 'consumer.heartbeat';
COMMIT_OFFSETS: 'consumer.commit_offsets';
GROUP_JOIN: 'consumer.group_join';
FETCH_START: 'consumer.fetch_start';
FETCH: 'consumer.fetch';
START_BATCH_PROCESS: 'consumer.start_batch_process';
END_BATCH_PROCESS: 'consumer.end_batch_process';
@@ -573,7 +644,7 @@ export interface ConsumerEvents {
REQUEST: 'consumer.network.request';
REQUEST_TIMEOUT: 'consumer.network.request_timeout';
REQUEST_QUEUE_SIZE: 'consumer.network.request_queue_size';
}
};
export type ConsumerHeartbeatEvent = InstrumentationEvent<{
groupId: string;
memberId: string;
@@ -643,7 +714,7 @@ export interface EachBatchPayload {
resolveOffset(offset: string): void;
heartbeat(): Promise<void>;
commitOffsetsIfNecessary(offsets?: Offsets): Promise<void>;
uncommittedOffsets(): Promise<OffsetsByTopicPartition>;
uncommittedOffsets(): OffsetsByTopicPartition;
isRunning(): boolean;
isStale(): boolean;
}
@@ -660,25 +731,29 @@ export type ConsumerEachMessagePayload = EachMessagePayload;
*/
export type ConsumerEachBatchPayload = EachBatchPayload;
export interface Consumer {
export type ConsumerRunConfig = {
autoCommit?: boolean;
autoCommitInterval?: number | null;
autoCommitThreshold?: number | null;
eachBatchAutoResolve?: boolean;
partitionsConsumedConcurrently?: number;
eachBatch?: (payload: EachBatchPayload) => Promise<void>;
eachMessage?: (payload: EachMessagePayload) => Promise<void>;
};
export type ConsumerSubscribeTopic = {
topic: string | RegExp;
fromBeginning?: boolean;
};
export type Consumer = {
connect(): Promise<void>;
disconnect(): Promise<void>;
subscribe(topic: {
topic: string | RegExp;
fromBeginning?: boolean;
}): Promise<void>;
subscribe(topic: ConsumerSubscribeTopic): Promise<void>;
stop(): Promise<void>;
run(config?: {
autoCommit?: boolean;
autoCommitInterval?: number | null;
autoCommitThreshold?: number | null;
eachBatchAutoResolve?: boolean;
partitionsConsumedConcurrently?: number;
eachBatch?: (payload: EachBatchPayload) => Promise<void>;
eachMessage?: (payload: EachMessagePayload) => Promise<void>;
}): Promise<void>;
run(config?: ConsumerRunConfig): Promise<void>;
commitOffsets(
topicPartitions: Array<TopicPartitionOffsetAndMedata>,
topicPartitions: Array<TopicPartitionOffsetAndMetadata>,
): Promise<void>;
seek(topicPartition: {
topic: string;
@@ -687,14 +762,15 @@ export interface Consumer {
}): void;
describeGroup(): Promise<GroupDescription>;
pause(topics: Array<{ topic: string; partitions?: number[] }>): void;
paused(): TopicPartitions[];
resume(topics: Array<{ topic: string; partitions?: number[] }>): void;
on(
eventName: ValueOf<ConsumerEvents>,
listener: (...args: any[]) => void,
): void;
): RemoveInstrumentationEventListener<typeof eventName>;
logger(): Logger;
events: ConsumerEvents;
}
};
export enum CompressionTypes {
None = 0,
@@ -710,3 +786,146 @@ export let CompressionCodecs: {
[CompressionTypes.LZ4]: () => any;
[CompressionTypes.ZSTD]: () => any;
};
export declare class KafkaJSError extends Error {
constructor(e: Error | string, metadata?: KafkaJSErrorMetadata);
}
export declare class KafkaJSNonRetriableError extends KafkaJSError {
constructor(e: Error | string);
}
export declare class KafkaJSProtocolError extends KafkaJSError {
constructor(e: Error | string);
}
export declare class KafkaJSOffsetOutOfRange extends KafkaJSProtocolError {
constructor(e: Error | string, metadata?: KafkaJSOffsetOutOfRangeMetadata);
}
export declare class KafkaJSNumberOfRetriesExceeded extends KafkaJSNonRetriableError {
constructor(
e: Error | string,
metadata?: KafkaJSNumberOfRetriesExceededMetadata,
);
}
export declare class KafkaJSConnectionError extends KafkaJSError {
constructor(e: Error | string, metadata?: KafkaJSConnectionErrorMetadata);
}
export declare class KafkaJSRequestTimeoutError extends KafkaJSError {
constructor(e: Error | string, metadata?: KafkaJSRequestTimeoutErrorMetadata);
}
export declare class KafkaJSMetadataNotLoaded extends KafkaJSError {
constructor();
}
export declare class KafkaJSTopicMetadataNotLoaded extends KafkaJSMetadataNotLoaded {
constructor(
e: Error | string,
metadata?: KafkaJSTopicMetadataNotLoadedMetadata,
);
}
export declare class KafkaJSStaleTopicMetadataAssignment extends KafkaJSError {
constructor(
e: Error | string,
metadata?: KafkaJSStaleTopicMetadataAssignmentMetadata,
);
}
export declare class KafkaJSServerDoesNotSupportApiKey extends KafkaJSNonRetriableError {
constructor(
e: Error | string,
metadata?: KafkaJSServerDoesNotSupportApiKeyMetadata,
);
}
export declare class KafkaJSBrokerNotFound extends KafkaJSError {
constructor();
}
export declare class KafkaJSPartialMessageError extends KafkaJSError {
constructor();
}
export declare class KafkaJSSASLAuthenticationError extends KafkaJSError {
constructor();
}
export declare class KafkaJSGroupCoordinatorNotFound extends KafkaJSError {
constructor();
}
export declare class KafkaJSNotImplemented extends KafkaJSError {
constructor();
}
export declare class KafkaJSTimeout extends KafkaJSError {
constructor();
}
export declare class KafkaJSLockTimeout extends KafkaJSError {
constructor();
}
export declare class KafkaJSUnsupportedMagicByteInMessageSet extends KafkaJSError {
constructor();
}
export declare class KafkaJSDeleteGroupsError extends KafkaJSError {
constructor(e: Error | string, groups?: KafkaJSDeleteGroupsErrorGroups[]);
}
export interface KafkaJSDeleteGroupsErrorGroups {
groupId: string;
errorCode: number;
error: KafkaJSError;
}
export interface KafkaJSErrorMetadata {
retriable?: boolean;
topic?: string;
partitionId?: number;
metadata?: PartitionMetadata;
}
export interface KafkaJSOffsetOutOfRangeMetadata {
topic: string;
partition: number;
}
export interface KafkaJSNumberOfRetriesExceededMetadata {
retryCount: number;
retryTime: number;
}
export interface KafkaJSConnectionErrorMetadata {
broker?: string;
code?: string;
}
export interface KafkaJSRequestTimeoutErrorMetadata {
broker: string;
clientId: string;
correlationId: number;
createdAt: number;
sentAt: number;
pendingDuration: number;
}
export interface KafkaJSTopicMetadataNotLoadedMetadata {
topic: string;
}
export interface KafkaJSStaleTopicMetadataAssignmentMetadata {
topic: string;
unknownPartitions: PartitionMetadata[];
}
export interface KafkaJSServerDoesNotSupportApiKeyMetadata {
apiKey: number;
apiName: string;
}

View File

@@ -12,13 +12,17 @@ export declare class Kafka {
logger(): Logger;
}
export type BrokersFunction = () => string[] | Promise<string[]>;
export interface KafkaConfig {
brokers: string[];
brokers: string[] | BrokersFunction;
ssl?: tls.ConnectionOptions | boolean;
sasl?: SASLOptions;
clientId?: string;
clientIdPostfix?: string;
connectionTimeout?: number;
authenticationTimeout?: number;
reauthenticationThreshold?: number;
requestTimeout?: number;
enforceRequestTimeout?: boolean;
retry?: RetryOptions;

View File

@@ -0,0 +1,11 @@
export interface RmqUrl {
protocol?: string;
hostname?: string;
port?: number;
username?: string;
password?: string;
locale?: string;
frameMax?: number;
heartbeat?: number;
vhost?: string;
}

View File

@@ -10,6 +10,8 @@ export class RpcParamsFactory {
return args[0];
case RpcParamtype.CONTEXT:
return args[1];
case RpcParamtype.GRPC_CALL:
return args[2];
default:
return null;
}

View File

@@ -12,6 +12,7 @@ import { Server } from '../server/server';
import { CustomTransportStrategy } from './custom-transport-strategy.interface';
import { Deserializer } from './deserializer.interface';
import { Serializer } from './serializer.interface';
import { RmqUrl } from '../external/rmq-url.interface';
export type MicroserviceOptions =
| GrpcOptions
@@ -113,13 +114,16 @@ export interface NatsOptions {
queue?: string;
serializer?: Serializer;
deserializer?: Deserializer;
userJWT?: string;
nonceSigner?: any;
userCreds?: any;
};
}
export interface RmqOptions {
transport?: Transport.RMQ;
options?: {
urls?: string[];
urls?: string[] | RmqUrl[];
queue?: string;
prefetchCount?: number;
isGlobalPrefetchCount?: boolean;
@@ -129,6 +133,7 @@ export interface RmqOptions {
serializer?: Serializer;
deserializer?: Deserializer;
replyQueue?: string;
persistent?: boolean;
};
}

View File

@@ -24,7 +24,8 @@ const { SocketModule } = optionalRequire(
() => require('@nestjs/websockets/socket-module'),
);
export class NestMicroservice extends NestApplicationContext
export class NestMicroservice
extends NestApplicationContext
implements INestMicroservice {
private readonly logger = new Logger(NestMicroservice.name, true);
private readonly microservicesModule = new MicroservicesModule();

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/microservices",
"version": "7.4.4",
"version": "7.5.5",
"description": "Nest - modern, fast, powerful node.js web framework (@microservices)",
"author": "Kamil Mysliwiec",
"license": "MIT",
@@ -19,11 +19,11 @@
"dependencies": {
"iterare": "1.2.1",
"json-socket": "0.3.0",
"tslib": "2.0.1"
"tslib": "2.0.3"
},
"devDependencies": {
"@nestjs/common": "7.4.4",
"@nestjs/core": "7.4.4"
"@nestjs/common": "7.5.5",
"@nestjs/core": "7.5.5"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",

View File

@@ -26,6 +26,7 @@ let grpcProtoLoaderPackage: any = {};
interface GrpcCall<TRequest = any, TMetadata = any> {
request: TRequest;
metadata: TMetadata;
sendMetadata: Function;
end: Function;
write: Function;
on: Function;
@@ -206,7 +207,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
public createUnaryServiceMethod(methodHandler: Function): Function {
return async (call: GrpcCall, callback: Function) => {
const handler = methodHandler(call.request, call.metadata);
const handler = methodHandler(call.request, call.metadata, call);
this.transformToObservable(await handler).subscribe(
data => callback(null, data),
(err: any) => callback(err),
@@ -216,7 +217,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
public createStreamServiceMethod(methodHandler: Function): Function {
return async (call: GrpcCall, callback: Function) => {
const handler = methodHandler(call.request, call.metadata);
const handler = methodHandler(call.request, call.metadata, call);
const result$ = this.transformToObservable(await handler);
await result$
.pipe(
@@ -254,7 +255,7 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
});
call.on('end', () => req.complete());
const handler = methodHandler(req.asObservable(), call.metadata);
const handler = methodHandler(req.asObservable(), call.metadata, call);
const res = this.transformToObservable(await handler);
if (isResponseStream) {
await res

View File

@@ -10,6 +10,7 @@ import {
import { KafkaContext } from '../ctx-host';
import { KafkaHeaders, Transport } from '../enums';
import {
BrokersFunction,
Consumer,
ConsumerConfig,
EachMessagePayload,
@@ -38,11 +39,11 @@ export class ServerKafka extends Server implements CustomTransportStrategy {
protected consumer: Consumer = null;
protected producer: Producer = null;
protected brokers: string[];
protected brokers: string[] | BrokersFunction;
protected clientId: string;
protected groupId: string;
constructor(private readonly options: KafkaOptions['options']) {
constructor(protected readonly options: KafkaOptions['options']) {
super();
const clientOptions =
@@ -55,8 +56,11 @@ export class ServerKafka extends Server implements CustomTransportStrategy {
// append a unique id to the clientId and groupId
// so they don't collide with a microservices client
this.clientId =
(clientOptions.clientId || KAFKA_DEFAULT_CLIENT) + '-server';
this.groupId = (consumerOptions.groupId || KAFKA_DEFAULT_GROUP) + '-server';
(clientOptions.clientId || KAFKA_DEFAULT_CLIENT) +
(clientOptions.clientIdPostfix || '-server');
this.groupId =
(consumerOptions.groupId || KAFKA_DEFAULT_GROUP) +
(clientOptions.clientIdPostfix || '-server');
kafkaPackage = this.loadPackage('kafkajs', ServerKafka.name, () =>
require('kafkajs'),

View File

@@ -123,11 +123,18 @@ export class ServerNats extends Server implements CustomTransportStrategy {
}
public getPublisher(publisher: Client, replyTo: string, id: string) {
return (response: any) => {
Object.assign(response, { id });
const outgoingResponse = this.serializer.serialize(response);
return publisher.publish(replyTo, outgoingResponse);
};
if (replyTo) {
return (response: any) => {
Object.assign(response, { id });
const outgoingResponse = this.serializer.serialize(response);
return publisher.publish(replyTo, outgoingResponse);
};
}
// In case "replyTo" topic is not provided, there's no need for a reply.
// Method returns a noop function instead
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {};
}
public handleError(stream: any) {

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,
@@ -20,21 +24,22 @@ import {
OutgoingResponse,
} from '../interfaces/packet.interface';
import { Server } from './server';
import { RmqUrl } from '../external/rmq-url.interface';
let rqmPackage: any = {};
export class ServerRMQ extends Server implements CustomTransportStrategy {
public readonly transportId = Transport.RMQ;
private server: any = null;
private channel: any = null;
private readonly urls: string[];
private readonly queue: string;
private readonly prefetchCount: number;
private readonly queueOptions: any;
private readonly isGlobalPrefetchCount: boolean;
protected server: any = null;
protected channel: any = null;
protected readonly urls: string[] | RmqUrl[];
protected readonly queue: string;
protected readonly prefetchCount: number;
protected readonly queueOptions: any;
protected readonly isGlobalPrefetchCount: boolean;
constructor(private readonly options: RmqOptions['options']) {
constructor(protected readonly options: RmqOptions['options']) {
super();
this.urls = this.getOptionsProp(this.options, 'urls') || [RQM_DEFAULT_URL];
this.queue =
@@ -110,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)) {
@@ -103,13 +105,13 @@ export abstract class Server {
}
}
public transformToObservable<T = any>(resultOrDeffered: any): Observable<T> {
if (resultOrDeffered instanceof Promise) {
return fromPromise(resultOrDeffered);
} else if (!this.isObservable(resultOrDeffered)) {
return of(resultOrDeffered);
public transformToObservable<T = any>(resultOrDeferred: any): Observable<T> {
if (resultOrDeferred instanceof Promise) {
return fromPromise(resultOrDeferred);
} else if (!this.isObservable(resultOrDeferred)) {
return of(resultOrDeferred);
}
return resultOrDeffered;
return resultOrDeferred;
}
public getOptionsProp<

View File

@@ -232,14 +232,14 @@ describe('ClientKafka', () => {
});
describe('close', () => {
const consumer = { disconnect: sinon.spy() };
const producer = { disconnect: sinon.spy() };
const consumer = { disconnect: sinon.stub().resolves() };
const producer = { disconnect: sinon.stub().resolves() };
beforeEach(() => {
(client as any).consumer = consumer;
(client as any).producer = producer;
});
it('should close server', () => {
client.close();
it('should close server', async () => {
await client.close();
expect(consumer.disconnect.calledOnce).to.be.true;
expect(producer.disconnect.calledOnce).to.be.true;

View File

@@ -142,23 +142,31 @@ describe('ServerNats', () => {
let pub, publisher;
const id = '1';
const replyTo = 'test';
beforeEach(() => {
publisherSpy = sinon.spy();
pub = {
publish: publisherSpy,
};
publisher = server.getPublisher(pub, replyTo, id);
});
it(`should return function`, () => {
expect(typeof server.getPublisher(null, null, id)).to.be.eql('function');
});
it(`should call "publish" with expected arguments`, () => {
it(`should call "publish" when replyTo provided`, () => {
const replyTo = 'test';
publisher = server.getPublisher(pub, replyTo, id);
const respond = 'test';
publisher({ respond, id });
expect(publisherSpy.calledWith(replyTo, { respond, id })).to.be.true;
});
it(`should not call "publish" when replyTo NOT provided`, () => {
const replyTo = undefined;
publisher = server.getPublisher(pub, replyTo, id);
const respond = 'test';
publisher({ respond, id });
expect(publisherSpy.notCalled);
});
});
describe('handleEvent', () => {
const channel = 'test';

View File

@@ -123,7 +123,7 @@ describe('Server', () => {
});
});
describe('transformToObservable', () => {
describe('when resultOrDeffered', () => {
describe('when resultOrDeferred', () => {
describe('is Promise', () => {
it('should returns Observable', async () => {
const value = 100;

View File

@@ -66,7 +66,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
#### Sponsors
@@ -84,12 +85,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
<td align="center" valign="middle">
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" 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/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/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
</tr></table>
## Backers

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

@@ -1,6 +1,6 @@
{
"name": "@nestjs/platform-express",
"version": "7.4.4",
"version": "7.5.5",
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
"author": "Kamil Mysliwiec",
"license": "MIT",
@@ -21,11 +21,11 @@
"cors": "2.8.5",
"express": "4.17.1",
"multer": "1.4.2",
"tslib": "2.0.1"
"tslib": "2.0.3"
},
"devDependencies": {
"@nestjs/common": "7.4.4",
"@nestjs/core": "7.4.4"
"@nestjs/common": "7.5.5",
"@nestjs/core": "7.5.5"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",

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