@feathersjs/transport-commons
Advanced tools
Comparing version 5.0.7 to 5.0.8
@@ -6,2 +6,13 @@ # Change Log | ||
## [5.0.8](https://github.com/feathersjs/feathers/compare/v5.0.7...v5.0.8) (2023-07-19) | ||
### Bug Fixes | ||
* **transport-commons:** Handle invalid service paths on socket lookups ([#3241](https://github.com/feathersjs/feathers/issues/3241)) ([c397ab3](https://github.com/feathersjs/feathers/commit/c397ab3a0cd184044ae4f73540549b30a396821c)) | ||
## [5.0.7](https://github.com/feathersjs/feathers/compare/v5.0.6...v5.0.7) (2023-07-14) | ||
@@ -8,0 +19,0 @@ |
@@ -5,7 +5,5 @@ "use strict"; | ||
const feathers_1 = require("@feathersjs/feathers"); | ||
const commons_1 = require("@feathersjs/commons"); | ||
const channels_1 = require("../channels"); | ||
const routing_1 = require("../routing"); | ||
const utils_1 = require("./utils"); | ||
const debug = (0, commons_1.createDebug)('@feathersjs/transport-commons'); | ||
function socket({ done, emit, socketMap, socketKey, getParams }) { | ||
@@ -38,5 +36,4 @@ return (app) => { | ||
result[method] = (...args) => { | ||
const path = args.shift(); | ||
debug(`Got '${method}' call for service '${path}'`); | ||
(0, utils_1.runMethod)(app, getParams(connection), path, method, args); | ||
const [path, ...rest] = args; | ||
(0, utils_1.runMethod)(app, getParams(connection), path, method, rest); | ||
}; | ||
@@ -43,0 +40,0 @@ } |
@@ -9,2 +9,2 @@ import { HookContext, Application, RealTimeConnection } from '@feathersjs/feathers'; | ||
export declare function getDispatcher(emit: string, socketMap: WeakMap<RealTimeConnection, any>, socketKey?: any): (event: string, channel: CombinedChannel, context: HookContext, data?: any) => void; | ||
export declare function runMethod(app: Application, connection: RealTimeConnection, path: string, method: string, args: any[]): Promise<void>; | ||
export declare function runMethod(app: Application, connection: RealTimeConnection, _path: string, _method: string, args: any[]): Promise<void>; |
@@ -54,3 +54,5 @@ "use strict"; | ||
exports.getDispatcher = getDispatcher; | ||
async function runMethod(app, connection, path, method, args) { | ||
async function runMethod(app, connection, _path, _method, args) { | ||
const path = typeof _path === 'string' ? _path : null; | ||
const method = typeof _method === 'string' ? _method : null; | ||
const trace = `method '${method}' on service '${path}'`; | ||
@@ -70,3 +72,3 @@ const methodArgs = args.slice(0); | ||
if (lookup === null) { | ||
throw new errors_1.NotFound(`Service '${path}' not found`); | ||
throw new errors_1.NotFound(path === null ? `Invalid service path` : `Service '${path}' not found`); | ||
} | ||
@@ -73,0 +75,0 @@ const { service, params: route = {} } = lookup; |
{ | ||
"name": "@feathersjs/transport-commons", | ||
"description": "Shared functionality for websocket providers", | ||
"version": "5.0.7", | ||
"version": "5.0.8", | ||
"homepage": "https://feathersjs.com", | ||
@@ -57,5 +57,5 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/commons": "^5.0.7", | ||
"@feathersjs/errors": "^5.0.7", | ||
"@feathersjs/feathers": "^5.0.7", | ||
"@feathersjs/commons": "^5.0.8", | ||
"@feathersjs/errors": "^5.0.8", | ||
"@feathersjs/feathers": "^5.0.8", | ||
"encodeurl": "^1.0.2", | ||
@@ -74,3 +74,3 @@ "lodash": "^4.17.21" | ||
}, | ||
"gitHead": "1ab855487d2dfacb114339c634621357bce3a56a" | ||
"gitHead": "414336a047a556f1986b4bb253416d5b8a973d9f" | ||
} |
import { Application, getServiceOptions, Params, RealTimeConnection } from '@feathersjs/feathers' | ||
import { createDebug } from '@feathersjs/commons' | ||
import { channels } from '../channels' | ||
@@ -7,4 +6,2 @@ import { routing } from '../routing' | ||
const debug = createDebug('@feathersjs/transport-commons') | ||
export interface SocketOptions { | ||
@@ -55,6 +52,5 @@ done: Promise<any> | ||
result[method] = (...args: any[]) => { | ||
const path = args.shift() | ||
const [path, ...rest] = args | ||
debug(`Got '${method}' call for service '${path}'`) | ||
runMethod(app, getParams(connection), path, method, args) | ||
runMethod(app, getParams(connection), path, method, rest) | ||
} | ||
@@ -61,0 +57,0 @@ } |
@@ -72,6 +72,8 @@ import { | ||
connection: RealTimeConnection, | ||
path: string, | ||
method: string, | ||
_path: string, | ||
_method: string, | ||
args: any[] | ||
) { | ||
const path = typeof _path === 'string' ? _path : null | ||
const method = typeof _method === 'string' ? _method : null | ||
const trace = `method '${method}' on service '${path}'` | ||
@@ -95,3 +97,3 @@ const methodArgs = args.slice(0) | ||
if (lookup === null) { | ||
throw new NotFound(`Service '${path}' not found`) | ||
throw new NotFound(path === null ? `Invalid service path` : `Service '${path}' not found`) | ||
} | ||
@@ -98,0 +100,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
139937
1746
Updated@feathersjs/commons@^5.0.8
Updated@feathersjs/errors@^5.0.8
Updated@feathersjs/feathers@^5.0.8