@nestjs/websockets 9.3.2 → 9.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +0 -1
- package/context/exception-filters-context.d.ts +3 -0
- package/context/exception-filters-context.js +3 -0
- package/decorators/connected-socket.decorator.d.ts +3 -0
- package/decorators/connected-socket.decorator.js +3 -0
- package/decorators/gateway-server.decorator.d.ts +2 -0
- package/decorators/gateway-server.decorator.js +2 -0
- package/decorators/socket-gateway.decorator.d.ts +2 -0
- package/decorators/subscribe-message.decorator.d.ts +2 -0
- package/decorators/subscribe-message.decorator.js +2 -0
- package/exceptions/base-ws-exception-filter.d.ts +3 -0
- package/exceptions/base-ws-exception-filter.js +3 -0
- package/exceptions/ws-exceptions-handler.d.ts +3 -0
- package/exceptions/ws-exceptions-handler.js +3 -0
- package/gateway-metadata-explorer.js +4 -1
- package/interfaces/gateway-metadata.interface.d.ts +2 -0
- package/interfaces/gateway-metadata.interface.js +2 -0
- package/interfaces/hooks/on-gateway-connection.interface.d.ts +3 -0
- package/interfaces/hooks/on-gateway-disconnect.interface.d.ts +3 -0
- package/interfaces/hooks/on-gateway-init.interface.d.ts +3 -0
- package/interfaces/nest-gateway.interface.d.ts +3 -0
- package/interfaces/server-and-event-streams-host.interface.d.ts +3 -0
- package/interfaces/web-socket-server.interface.d.ts +3 -0
- package/interfaces/ws-response.interface.d.ts +3 -0
- package/package.json +3 -3
package/Readme.md
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
12
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
13
|
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
15
14
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
16
15
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
17
16
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BaseExceptionFilterContext } from '@nestjs/core/exceptions/base-exception-filter-context';
|
|
2
2
|
import { NestContainer } from '@nestjs/core/injector/container';
|
|
3
3
|
import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler';
|
|
4
|
+
/**
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
4
7
|
export declare class ExceptionFiltersContext extends BaseExceptionFilterContext {
|
|
5
8
|
constructor(container: NestContainer);
|
|
6
9
|
create(instance: object, callback: <TClient>(client: TClient, data: any) => any, moduleKey: string): WsExceptionsHandler;
|
|
@@ -5,6 +5,9 @@ const constants_1 = require("@nestjs/common/constants");
|
|
|
5
5
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
6
6
|
const base_exception_filter_context_1 = require("@nestjs/core/exceptions/base-exception-filter-context");
|
|
7
7
|
const ws_exceptions_handler_1 = require("../exceptions/ws-exceptions-handler");
|
|
8
|
+
/**
|
|
9
|
+
* @publicApi
|
|
10
|
+
*/
|
|
8
11
|
class ExceptionFiltersContext extends base_exception_filter_context_1.BaseExceptionFilterContext {
|
|
9
12
|
constructor(container) {
|
|
10
13
|
super(container);
|
|
@@ -3,4 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConnectedSocket = void 0;
|
|
4
4
|
const ws_paramtype_enum_1 = require("../enums/ws-paramtype.enum");
|
|
5
5
|
const param_utils_1 = require("../utils/param.utils");
|
|
6
|
+
/**
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
6
9
|
exports.ConnectedSocket = (0, param_utils_1.createWsParamDecorator)(ws_paramtype_enum_1.WsParamtype.SOCKET);
|
|
@@ -2,6 +2,8 @@ import { GatewayMetadata } from '../interfaces';
|
|
|
2
2
|
/**
|
|
3
3
|
* Decorator that marks a class as a Nest gateway that enables real-time, bidirectional
|
|
4
4
|
* and event-based communication between the browser and the server.
|
|
5
|
+
*
|
|
6
|
+
* @publicApi
|
|
5
7
|
*/
|
|
6
8
|
export declare function WebSocketGateway(port?: number): ClassDecorator;
|
|
7
9
|
export declare function WebSocketGateway<T extends Record<string, any> = GatewayMetadata>(options?: T): ClassDecorator;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ArgumentsHost, WsExceptionFilter } from '@nestjs/common';
|
|
2
|
+
/**
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
2
5
|
export declare class BaseWsExceptionFilter<TError = any> implements WsExceptionFilter<TError> {
|
|
3
6
|
private static readonly logger;
|
|
4
7
|
catch(exception: TError, host: ArgumentsHost): void;
|
|
@@ -5,6 +5,9 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
6
6
|
const constants_1 = require("@nestjs/core/constants");
|
|
7
7
|
const ws_exception_1 = require("../errors/ws-exception");
|
|
8
|
+
/**
|
|
9
|
+
* @publicApi
|
|
10
|
+
*/
|
|
8
11
|
class BaseWsExceptionFilter {
|
|
9
12
|
catch(exception, host) {
|
|
10
13
|
const client = host.switchToWs().getClient();
|
|
@@ -2,6 +2,9 @@ import { ArgumentsHost } from '@nestjs/common';
|
|
|
2
2
|
import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions/exception-filter-metadata.interface';
|
|
3
3
|
import { WsException } from '../errors/ws-exception';
|
|
4
4
|
import { BaseWsExceptionFilter } from './base-ws-exception-filter';
|
|
5
|
+
/**
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
5
8
|
export declare class WsExceptionsHandler extends BaseWsExceptionFilter {
|
|
6
9
|
private filters;
|
|
7
10
|
handle(exception: Error | WsException | any, host: ArgumentsHost): void;
|
|
@@ -4,6 +4,9 @@ exports.WsExceptionsHandler = void 0;
|
|
|
4
4
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
5
5
|
const invalid_exception_filter_exception_1 = require("@nestjs/core/errors/exceptions/invalid-exception-filter.exception");
|
|
6
6
|
const base_ws_exception_filter_1 = require("./base-ws-exception-filter");
|
|
7
|
+
/**
|
|
8
|
+
* @publicApi
|
|
9
|
+
*/
|
|
7
10
|
class WsExceptionsHandler extends base_ws_exception_filter_1.BaseWsExceptionFilter {
|
|
8
11
|
constructor() {
|
|
9
12
|
super(...arguments);
|
|
@@ -9,7 +9,10 @@ class GatewayMetadataExplorer {
|
|
|
9
9
|
}
|
|
10
10
|
explore(instance) {
|
|
11
11
|
const instancePrototype = Object.getPrototypeOf(instance);
|
|
12
|
-
return this.metadataScanner
|
|
12
|
+
return this.metadataScanner
|
|
13
|
+
.getAllMethodNames(instancePrototype)
|
|
14
|
+
.map(method => this.exploreMethodMetadata(instancePrototype, method))
|
|
15
|
+
.filter(metadata => metadata);
|
|
13
16
|
}
|
|
14
17
|
exploreMethodMetadata(instancePrototype, methodName) {
|
|
15
18
|
const callback = instancePrototype[methodName];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/websockets",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.4",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@websockets)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"tslib": "2.5.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@nestjs/common": "9.3.
|
|
21
|
-
"@nestjs/core": "9.3.
|
|
20
|
+
"@nestjs/common": "9.3.4",
|
|
21
|
+
"@nestjs/core": "9.3.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@nestjs/common": "^9.0.0",
|