@nestjs/websockets
Advanced tools
Comparing version 8.1.0 to 8.1.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./ws-adapter"), exports); | ||
tslib_1.__exportStar(require("./ws-adapter"), exports); |
@@ -23,3 +23,3 @@ "use strict"; | ||
async close(server) { | ||
const isCallable = server && (0, shared_utils_1.isFunction)(server.close); | ||
const isCallable = server && shared_utils_1.isFunction(server.close); | ||
isCallable && (await new Promise(resolve => server.close(resolve))); | ||
@@ -26,0 +26,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
const filters = this.createContext(instance, callback, constants_1.EXCEPTION_FILTERS_METADATA); | ||
if ((0, shared_utils_1.isEmpty)(filters)) { | ||
if (shared_utils_1.isEmpty(filters)) { | ||
return exceptionHandler; | ||
@@ -19,0 +19,0 @@ } |
@@ -112,3 +112,3 @@ "use strict"; | ||
async getParamValue(value, { metatype, type, data }, pipes) { | ||
return (0, shared_utils_1.isEmpty)(pipes) | ||
return shared_utils_1.isEmpty(pipes) | ||
? value | ||
@@ -115,0 +115,0 @@ : this.pipesConsumer.apply(value, { metatype, type, data }, pipes); |
@@ -15,5 +15,5 @@ "use strict"; | ||
? result | ||
: result.pipe((0, operators_1.catchError)(error => { | ||
: result.pipe(operators_1.catchError(error => { | ||
this.handleError(exceptionsHandler, args, error); | ||
return (0, rxjs_1.empty)(); | ||
return rxjs_1.empty(); | ||
})); | ||
@@ -32,5 +32,5 @@ } | ||
isObservable(result) { | ||
return result && (0, shared_utils_1.isFunction)(result.subscribe); | ||
return result && shared_utils_1.isFunction(result.subscribe); | ||
} | ||
} | ||
exports.WsProxy = WsProxy; |
@@ -6,2 +6,2 @@ "use strict"; | ||
const param_utils_1 = require("../utils/param.utils"); | ||
exports.ConnectedSocket = (0, param_utils_1.createWsParamDecorator)(ws_paramtype_enum_1.WsParamtype.SOCKET); | ||
exports.ConnectedSocket = param_utils_1.createWsParamDecorator(ws_paramtype_enum_1.WsParamtype.SOCKET); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./connected-socket.decorator"), exports); | ||
(0, tslib_1.__exportStar)(require("./gateway-server.decorator"), exports); | ||
(0, tslib_1.__exportStar)(require("./message-body.decorator"), exports); | ||
(0, tslib_1.__exportStar)(require("./socket-gateway.decorator"), exports); | ||
(0, tslib_1.__exportStar)(require("./subscribe-message.decorator"), exports); | ||
tslib_1.__exportStar(require("./connected-socket.decorator"), exports); | ||
tslib_1.__exportStar(require("./gateway-server.decorator"), exports); | ||
tslib_1.__exportStar(require("./message-body.decorator"), exports); | ||
tslib_1.__exportStar(require("./socket-gateway.decorator"), exports); | ||
tslib_1.__exportStar(require("./subscribe-message.decorator"), exports); |
@@ -7,4 +7,4 @@ "use strict"; | ||
function MessageBody(propertyOrPipe, ...pipes) { | ||
return (0, param_utils_1.createPipesWsParamDecorator)(ws_paramtype_enum_1.WsParamtype.PAYLOAD)(propertyOrPipe, ...pipes); | ||
return param_utils_1.createPipesWsParamDecorator(ws_paramtype_enum_1.WsParamtype.PAYLOAD)(propertyOrPipe, ...pipes); | ||
} | ||
exports.MessageBody = MessageBody; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./ws-exception"), exports); | ||
tslib_1.__exportStar(require("./ws-exception"), exports); |
@@ -12,7 +12,7 @@ "use strict"; | ||
initMessage() { | ||
if ((0, shared_utils_1.isString)(this.error)) { | ||
if (shared_utils_1.isString(this.error)) { | ||
this.message = this.error; | ||
} | ||
else if ((0, shared_utils_1.isObject)(this.error) && | ||
(0, shared_utils_1.isString)(this.error.message)) { | ||
else if (shared_utils_1.isObject(this.error) && | ||
shared_utils_1.isString(this.error.message)) { | ||
this.message = this.error.message; | ||
@@ -19,0 +19,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
const result = exception.getError(); | ||
const message = (0, shared_utils_1.isObject)(result) | ||
const message = shared_utils_1.isObject(result) | ||
? result | ||
@@ -40,3 +40,3 @@ : { | ||
isExceptionObject(err) { | ||
return (0, shared_utils_1.isObject)(err) && !!err.message; | ||
return shared_utils_1.isObject(err) && !!err.message; | ||
} | ||
@@ -43,0 +43,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./base-ws-exception-filter"), exports); | ||
tslib_1.__exportStar(require("./base-ws-exception-filter"), exports); |
@@ -26,3 +26,3 @@ "use strict"; | ||
invokeCustomFilters(exception, args) { | ||
if ((0, shared_utils_1.isEmpty)(this.filters)) | ||
if (shared_utils_1.isEmpty(this.filters)) | ||
return false; | ||
@@ -29,0 +29,0 @@ const filter = this.filters.find(({ exceptionMetatypes }) => { |
@@ -17,3 +17,3 @@ "use strict"; | ||
const isMessageMapping = Reflect.getMetadata(constants_1.MESSAGE_MAPPING_METADATA, callback); | ||
if ((0, shared_utils_1.isUndefined)(isMessageMapping)) { | ||
if (shared_utils_1.isUndefined(isMessageMapping)) { | ||
return null; | ||
@@ -30,3 +30,3 @@ } | ||
for (const propertyKey in instance) { | ||
if ((0, shared_utils_1.isFunction)(propertyKey)) { | ||
if (shared_utils_1.isFunction(propertyKey)) { | ||
continue; | ||
@@ -36,3 +36,3 @@ } | ||
const isServer = Reflect.getMetadata(constants_1.GATEWAY_SERVER_METADATA, instance, property); | ||
if (!(0, shared_utils_1.isUndefined)(isServer)) { | ||
if (!shared_utils_1.isUndefined(isServer)) { | ||
yield property; | ||
@@ -39,0 +39,0 @@ } |
10
index.js
@@ -11,6 +11,6 @@ "use strict"; | ||
require("reflect-metadata"); | ||
(0, tslib_1.__exportStar)(require("./adapters"), exports); | ||
(0, tslib_1.__exportStar)(require("./decorators"), exports); | ||
(0, tslib_1.__exportStar)(require("./errors"), exports); | ||
(0, tslib_1.__exportStar)(require("./exceptions"), exports); | ||
(0, tslib_1.__exportStar)(require("./interfaces"), exports); | ||
tslib_1.__exportStar(require("./adapters"), exports); | ||
tslib_1.__exportStar(require("./decorators"), exports); | ||
tslib_1.__exportStar(require("./errors"), exports); | ||
tslib_1.__exportStar(require("./exceptions"), exports); | ||
tslib_1.__exportStar(require("./interfaces"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./on-gateway-connection.interface"), exports); | ||
(0, tslib_1.__exportStar)(require("./on-gateway-disconnect.interface"), exports); | ||
(0, tslib_1.__exportStar)(require("./on-gateway-init.interface"), exports); | ||
tslib_1.__exportStar(require("./on-gateway-connection.interface"), exports); | ||
tslib_1.__exportStar(require("./on-gateway-disconnect.interface"), exports); | ||
tslib_1.__exportStar(require("./on-gateway-init.interface"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./gateway-metadata.interface"), exports); | ||
(0, tslib_1.__exportStar)(require("./hooks"), exports); | ||
(0, tslib_1.__exportStar)(require("./server-and-event-streams-host.interface"), exports); | ||
(0, tslib_1.__exportStar)(require("./web-socket-server.interface"), exports); | ||
(0, tslib_1.__exportStar)(require("./ws-response.interface"), exports); | ||
tslib_1.__exportStar(require("./gateway-metadata.interface"), exports); | ||
tslib_1.__exportStar(require("./hooks"), exports); | ||
tslib_1.__exportStar(require("./server-and-event-streams-host.interface"), exports); | ||
tslib_1.__exportStar(require("./web-socket-server.interface"), exports); | ||
tslib_1.__exportStar(require("./ws-response.interface"), exports); |
{ | ||
"name": "@nestjs/websockets", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@websockets)", | ||
@@ -20,4 +20,4 @@ "author": "Kamil Mysliwiec", | ||
"devDependencies": { | ||
"@nestjs/common": "8.1.0", | ||
"@nestjs/core": "8.1.0" | ||
"@nestjs/common": "8.1.1", | ||
"@nestjs/core": "8.1.1" | ||
}, | ||
@@ -24,0 +24,0 @@ "peerDependencies": { |
@@ -33,3 +33,3 @@ "use strict"; | ||
connectAllGateways(providers, moduleName) { | ||
(0, iterare_1.iterate)(providers.values()) | ||
iterare_1.iterate(providers.values()) | ||
.filter(wrapper => wrapper && !wrapper.isNotMetatype) | ||
@@ -59,3 +59,3 @@ .forEach(wrapper => this.connectGatewayToServer(wrapper, moduleName)); | ||
const servers = this.socketsContainer.getAll(); | ||
await Promise.all((0, iterare_1.iterate)(servers.values()) | ||
await Promise.all(iterare_1.iterate(servers.values()) | ||
.filter(({ server }) => server) | ||
@@ -72,3 +72,3 @@ .map(async ({ server }) => adapter.close(server))); | ||
} | ||
const { IoAdapter } = (0, load_adapter_1.loadAdapter)('@nestjs/platform-socket.io', 'WebSockets', () => require('@nestjs/platform-socket.io')); | ||
const { IoAdapter } = load_adapter_1.loadAdapter('@nestjs/platform-socket.io', 'WebSockets', () => require('@nestjs/platform-socket.io')); | ||
const ioAdapter = new IoAdapter(this.httpServer); | ||
@@ -75,0 +75,0 @@ this.applicationConfig.setIoAdapter(ioAdapter); |
@@ -26,3 +26,3 @@ "use strict"; | ||
const adapter = this.applicationConfig.getIoAdapter(); | ||
const _a = options, { namespace, server } = _a, partialOptions = (0, tslib_1.__rest)(_a, ["namespace", "server"]); | ||
const _a = options, { namespace, server } = _a, partialOptions = tslib_1.__rest(_a, ["namespace", "server"]); | ||
const ioServer = adapter.create(port, partialOptions); | ||
@@ -47,8 +47,8 @@ const serverAndEventStreamsHost = server_and_event_streams_factory_1.ServerAndEventStreamsFactory.create(ioServer); | ||
validateNamespace(namespace) { | ||
if (!(0, shared_utils_1.isString)(namespace)) { | ||
if (!shared_utils_1.isString(namespace)) { | ||
return namespace; | ||
} | ||
return (0, shared_utils_1.addLeadingSlash)(namespace); | ||
return shared_utils_1.addLeadingSlash(namespace); | ||
} | ||
} | ||
exports.SocketServerProvider = SocketServerProvider; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./param.utils"), exports); | ||
tslib_1.__exportStar(require("./param.utils"), exports); |
@@ -11,3 +11,3 @@ "use strict"; | ||
const args = Reflect.getMetadata(constants_1.PARAM_ARGS_METADATA, target.constructor, key) || {}; | ||
Reflect.defineMetadata(constants_1.PARAM_ARGS_METADATA, (0, route_params_decorator_1.assignMetadata)(args, paramtype, index, undefined, ...pipes), target.constructor, key); | ||
Reflect.defineMetadata(constants_1.PARAM_ARGS_METADATA, route_params_decorator_1.assignMetadata(args, paramtype, index, undefined, ...pipes), target.constructor, key); | ||
}; | ||
@@ -18,7 +18,7 @@ } | ||
const args = Reflect.getMetadata(constants_1.PARAM_ARGS_METADATA, target.constructor, key) || {}; | ||
const hasParamData = (0, shared_utils_1.isNil)(data) || (0, shared_utils_1.isString)(data); | ||
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data); | ||
const paramData = hasParamData ? data : undefined; | ||
const paramPipes = hasParamData ? pipes : [data, ...pipes]; | ||
Reflect.defineMetadata(constants_1.PARAM_ARGS_METADATA, (0, route_params_decorator_1.assignMetadata)(args, paramtype, index, paramData, ...paramPipes), target.constructor, key); | ||
Reflect.defineMetadata(constants_1.PARAM_ARGS_METADATA, route_params_decorator_1.assignMetadata(args, paramtype, index, paramData, ...paramPipes), target.constructor, key); | ||
}; | ||
exports.createPipesWsParamDecorator = createPipesWsParamDecorator; |
@@ -71,3 +71,3 @@ "use strict"; | ||
event | ||
.pipe((0, operators_1.distinctUntilChanged)((prev, curr) => (0, compare_element_util_1.compareElementAt)(prev, curr, 0))) | ||
.pipe(operators_1.distinctUntilChanged((prev, curr) => compare_element_util_1.compareElementAt(prev, curr, 0))) | ||
.subscribe((args) => instance.handleConnection(...args)); | ||
@@ -79,3 +79,3 @@ } | ||
event | ||
.pipe((0, operators_1.distinctUntilChanged)()) | ||
.pipe(operators_1.distinctUntilChanged()) | ||
.subscribe(instance.handleDisconnect.bind(instance)); | ||
@@ -90,3 +90,3 @@ } | ||
})); | ||
adapter.bindMessageHandlers(client, handlers, data => (0, rxjs_1.from)(this.pickResult(data)).pipe((0, operators_1.mergeAll)())); | ||
adapter.bindMessageHandlers(client, handlers, data => rxjs_1.from(this.pickResult(data)).pipe(operators_1.mergeAll())); | ||
subscribersMap.forEach(({ callback, message }) => { | ||
@@ -98,9 +98,9 @@ this.logger.log(`Subscribe ${instance.constructor.name}.${callback.name} method to ${message} message.`); | ||
const result = await deferredResult; | ||
if (result && (0, shared_utils_1.isFunction)(result.subscribe)) { | ||
if (result && shared_utils_1.isFunction(result.subscribe)) { | ||
return result; | ||
} | ||
if (result instanceof Promise) { | ||
return (0, rxjs_1.from)(result); | ||
return rxjs_1.from(result); | ||
} | ||
return (0, rxjs_1.of)(result); | ||
return rxjs_1.of(result); | ||
} | ||
@@ -107,0 +107,0 @@ assignServerToProperties(instance, server) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77488