mirror of
https://github.com/nestjs/nest.git
synced 2026-02-27 19:21:46 +00:00
Compare commits
6 Commits
v10.4.6
...
fix/instan
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f273041594 | ||
|
|
da8ebded25 | ||
|
|
bc4667c15a | ||
|
|
a544552f72 | ||
|
|
954616da7d | ||
|
|
c6b95f54a7 |
@@ -94,7 +94,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/logos/mercedes-logo.png" width="100" valign="middle" /></a></td>
|
||||
<td><a href="https://www.dinii.jp/" target="_blank"><img src="https://nestjs.com/img/logos/dinii-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td><a href="https://bloodycase.com/?promocode=NEST" target="_blank"><img src="https://nestjs.com/img/logos/bloodycase-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/logos/handsontable-logo.svg" width="150" valign="middle" /></a></td>
|
||||
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/logos/handsontable-dark-logo.svg#2" width="150" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/logos/it_flashcards-logo.png" width="170" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle"><a href="https://arcjet.com/?ref=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/arcjet-logo.svg" width="170" valign="middle" /></a></td>
|
||||
</tr>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "10.4.6"
|
||||
"version": "10.4.7"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/common",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"homepage": "https://nestjs.com",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/core",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -36,7 +36,7 @@
|
||||
"uid": "2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "10.4.6"
|
||||
"@nestjs/common": "10.4.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^10.0.0",
|
||||
|
||||
@@ -39,25 +39,36 @@ export class ListenerMetadataExplorer {
|
||||
const instancePrototype = Object.getPrototypeOf(instance);
|
||||
return this.metadataScanner
|
||||
.getAllMethodNames(instancePrototype)
|
||||
.map(method => this.exploreMethodMetadata(instancePrototype, method))
|
||||
.map(method =>
|
||||
this.exploreMethodMetadata(instance, instancePrototype, method),
|
||||
)
|
||||
.filter(metadata => metadata);
|
||||
}
|
||||
|
||||
public exploreMethodMetadata(
|
||||
instance: Controller,
|
||||
instancePrototype: object,
|
||||
methodKey: string,
|
||||
): EventOrMessageListenerDefinition {
|
||||
const targetCallback = instancePrototype[methodKey];
|
||||
const prototypeCallback = instancePrototype[methodKey];
|
||||
const handlerType = Reflect.getMetadata(
|
||||
PATTERN_HANDLER_METADATA,
|
||||
targetCallback,
|
||||
prototypeCallback,
|
||||
);
|
||||
if (isUndefined(handlerType)) {
|
||||
return;
|
||||
}
|
||||
const patterns = Reflect.getMetadata(PATTERN_METADATA, targetCallback);
|
||||
const transport = Reflect.getMetadata(TRANSPORT_METADATA, targetCallback);
|
||||
const extras = Reflect.getMetadata(PATTERN_EXTRAS_METADATA, targetCallback);
|
||||
const patterns = Reflect.getMetadata(PATTERN_METADATA, prototypeCallback);
|
||||
const transport = Reflect.getMetadata(
|
||||
TRANSPORT_METADATA,
|
||||
prototypeCallback,
|
||||
);
|
||||
const extras = Reflect.getMetadata(
|
||||
PATTERN_EXTRAS_METADATA,
|
||||
prototypeCallback,
|
||||
);
|
||||
|
||||
const targetCallback = instance[methodKey];
|
||||
return {
|
||||
methodKey,
|
||||
targetCallback,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/microservices",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@microservices)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -22,8 +22,8 @@
|
||||
"tslib": "2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "10.4.6",
|
||||
"@nestjs/core": "10.4.6"
|
||||
"@nestjs/common": "10.4.7",
|
||||
"@nestjs/core": "10.4.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@grpc/grpc-js": "*",
|
||||
|
||||
@@ -71,6 +71,7 @@ describe('ListenerMetadataExplorer', () => {
|
||||
});
|
||||
it(`should return undefined when "handlerType" metadata is undefined`, () => {
|
||||
const metadata = instance.exploreMethodMetadata(
|
||||
test,
|
||||
Object.getPrototypeOf(test),
|
||||
'noPattern',
|
||||
);
|
||||
@@ -80,6 +81,7 @@ describe('ListenerMetadataExplorer', () => {
|
||||
describe('@MessagePattern', () => {
|
||||
it(`should return pattern properties when "handlerType" metadata is not undefined`, () => {
|
||||
const metadata = instance.exploreMethodMetadata(
|
||||
test,
|
||||
Object.getPrototypeOf(test),
|
||||
'testMessage',
|
||||
);
|
||||
@@ -96,6 +98,7 @@ describe('ListenerMetadataExplorer', () => {
|
||||
});
|
||||
it(`should return multiple patterns when more than one is declared`, () => {
|
||||
const metadata = instance.exploreMethodMetadata(
|
||||
test,
|
||||
Object.getPrototypeOf(test),
|
||||
'testMultipleMessage',
|
||||
);
|
||||
@@ -116,6 +119,7 @@ describe('ListenerMetadataExplorer', () => {
|
||||
describe('@EventPattern', () => {
|
||||
it(`should return pattern properties when "handlerType" metadata is not undefined`, () => {
|
||||
const metadata = instance.exploreMethodMetadata(
|
||||
test,
|
||||
Object.getPrototypeOf(test),
|
||||
'testEvent',
|
||||
);
|
||||
@@ -132,6 +136,7 @@ describe('ListenerMetadataExplorer', () => {
|
||||
});
|
||||
it(`should return multiple patterns when more than one is declared`, () => {
|
||||
const metadata = instance.exploreMethodMetadata(
|
||||
test,
|
||||
Object.getPrototypeOf(test),
|
||||
'testMultipleEvent',
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-express",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -25,8 +25,8 @@
|
||||
"tslib": "2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "10.4.6",
|
||||
"@nestjs/core": "10.4.6"
|
||||
"@nestjs/common": "10.4.7",
|
||||
"@nestjs/core": "10.4.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^10.0.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { INestApplication, HttpServer } from '@nestjs/common';
|
||||
import { HttpServer, INestApplication } from '@nestjs/common';
|
||||
import {
|
||||
FastifyBodyParser,
|
||||
FastifyInstance,
|
||||
@@ -7,14 +7,14 @@ import {
|
||||
FastifyPluginCallback,
|
||||
FastifyPluginOptions,
|
||||
FastifyRegisterOptions,
|
||||
FastifyRequest,
|
||||
FastifyReply,
|
||||
FastifyRequest,
|
||||
RawServerBase,
|
||||
RawServerDefault,
|
||||
} from 'fastify';
|
||||
import {
|
||||
Chain as LightMyRequestChain,
|
||||
InjectOptions,
|
||||
Chain as LightMyRequestChain,
|
||||
Response as LightMyRequestResponse,
|
||||
} from 'light-my-request';
|
||||
import { FastifyStaticOptions, FastifyViewOptions } from './external';
|
||||
@@ -98,33 +98,19 @@ export interface NestFastifyApplication<
|
||||
opts: FastifyListenOptions,
|
||||
callback?: (err: Error | null, address: string) => void,
|
||||
): Promise<TServer>;
|
||||
listen(
|
||||
opts?: FastifyListenOptions,
|
||||
): Promise<TServer>;
|
||||
listen(opts?: FastifyListenOptions): Promise<TServer>;
|
||||
listen(
|
||||
callback?: (err: Error | null, address: string) => void,
|
||||
): Promise<TServer>;
|
||||
/**
|
||||
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
|
||||
* @see https://github.com/fastify/fastify/pull/3712
|
||||
*/
|
||||
listen(
|
||||
port: number | string,
|
||||
callback?: (err: Error | null, address: string) => void,
|
||||
): Promise<TServer>;
|
||||
/**
|
||||
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
|
||||
* @see https://github.com/fastify/fastify/pull/3712
|
||||
*/
|
||||
listen(
|
||||
port: number | string,
|
||||
address: string,
|
||||
callback?: (err: Error | null, address: string) => void,
|
||||
): Promise<TServer>;
|
||||
/**
|
||||
* @deprecated Variadic listen method is deprecated. Please use `.listen(optionsObject, callback)` instead. The variadic signature will be removed in `fastify@5`
|
||||
* @see https://github.com/fastify/fastify/pull/3712
|
||||
*/
|
||||
listen(
|
||||
port: number | string,
|
||||
address: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-fastify",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-socket.io",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-socket.io)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-ws",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-ws)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/testing",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@testing)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/websockets",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@websockets)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -18,8 +18,8 @@
|
||||
"tslib": "2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "10.4.6",
|
||||
"@nestjs/core": "10.4.6"
|
||||
"@nestjs/common": "10.4.7",
|
||||
"@nestjs/core": "10.4.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^10.0.0",
|
||||
|
||||
Reference in New Issue
Block a user