@feathersjs/transport-commons
Advanced tools
Comparing version 5.0.10 to 5.0.11
@@ -6,2 +6,9 @@ # Change Log | ||
## [5.0.11](https://github.com/feathersjs/feathers/compare/v5.0.10...v5.0.11) (2023-10-11) | ||
### Bug Fixes | ||
- **client:** Replace placeholders in URL with route params ([#3270](https://github.com/feathersjs/feathers/issues/3270)) ([a0624eb](https://github.com/feathersjs/feathers/commit/a0624eb5a7919aa1b179a71beb1c1b9cab574525)) | ||
- **knex:** Update all dependencies and Knex peer ([#3308](https://github.com/feathersjs/feathers/issues/3308)) ([d2f9860](https://github.com/feathersjs/feathers/commit/d2f986036c4741cce2339d8abbcc6b2eb037a12a)) | ||
## [5.0.10](https://github.com/feathersjs/feathers/compare/v5.0.9...v5.0.10) (2023-10-03) | ||
@@ -8,0 +15,0 @@ |
@@ -55,3 +55,10 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
args.unshift(method, this.path); | ||
const route = args.pop(); | ||
let path = this.path; | ||
if (route) { | ||
Object.keys(route).forEach((key) => { | ||
path = path.replace(`:${key}`, route[key]); | ||
}); | ||
} | ||
args.unshift(method, path); | ||
args.push(function (error, data) { | ||
@@ -68,6 +75,6 @@ return error ? reject((0, errors_1.convert)(error)) : resolve(data); | ||
this[_method] = function (data, params = {}) { | ||
return this.send(method, data, params.query || {}); | ||
return this.send(method, data, params.query || {}, params.route || {}); | ||
}; | ||
this[method] = function (data, params = {}) { | ||
return this[_method](data, params); | ||
return this[_method](data, params, params.route || {}); | ||
}; | ||
@@ -78,3 +85,3 @@ }); | ||
_find(params = {}) { | ||
return this.send('find', params.query || {}); | ||
return this.send('find', params.query || {}, params.route || {}); | ||
} | ||
@@ -85,3 +92,3 @@ find(params = {}) { | ||
_get(id, params = {}) { | ||
return this.send('get', id, params.query || {}); | ||
return this.send('get', id, params.query || {}, params.route || {}); | ||
} | ||
@@ -92,3 +99,3 @@ get(id, params = {}) { | ||
_create(data, params = {}) { | ||
return this.send('create', data, params.query || {}); | ||
return this.send('create', data, params.query || {}, params.route || {}); | ||
} | ||
@@ -102,3 +109,3 @@ create(data, params = {}) { | ||
} | ||
return this.send('update', id, data, params.query || {}); | ||
return this.send('update', id, data, params.query || {}, params.route || {}); | ||
} | ||
@@ -109,3 +116,3 @@ update(id, data, params = {}) { | ||
_patch(id, data, params = {}) { | ||
return this.send('patch', id, data, params.query || {}); | ||
return this.send('patch', id, data, params.query || {}, params.route || {}); | ||
} | ||
@@ -116,3 +123,3 @@ patch(id, data, params = {}) { | ||
_remove(id, params = {}) { | ||
return this.send('remove', id, params.query || {}); | ||
return this.send('remove', id, params.query || {}, params.route || {}); | ||
} | ||
@@ -119,0 +126,0 @@ remove(id, params = {}) { |
{ | ||
"name": "@feathersjs/transport-commons", | ||
"description": "Shared functionality for websocket providers", | ||
"version": "5.0.10", | ||
"version": "5.0.11", | ||
"homepage": "https://feathersjs.com", | ||
@@ -57,5 +57,5 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/commons": "^5.0.10", | ||
"@feathersjs/errors": "^5.0.10", | ||
"@feathersjs/feathers": "^5.0.10", | ||
"@feathersjs/commons": "^5.0.11", | ||
"@feathersjs/errors": "^5.0.11", | ||
"@feathersjs/feathers": "^5.0.11", | ||
"encodeurl": "^1.0.2", | ||
@@ -68,3 +68,3 @@ "lodash": "^4.17.21" | ||
"@types/mocha": "^10.0.2", | ||
"@types/node": "^20.8.2", | ||
"@types/node": "^20.8.4", | ||
"mocha": "^10.2.0", | ||
@@ -75,3 +75,3 @@ "shx": "^0.3.4", | ||
}, | ||
"gitHead": "463dedcd35b16e43bc55e04df877ca82ed38dcea" | ||
"gitHead": "91294817845178ff0e9d4709127cb3e46d3562be" | ||
} |
@@ -81,3 +81,10 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
return new Promise<X>((resolve, reject) => { | ||
args.unshift(method, this.path) | ||
const route: Record<string, any> = args.pop() | ||
let path = this.path | ||
if (route) { | ||
Object.keys(route).forEach((key) => { | ||
path = path.replace(`:${key}`, route[key]) | ||
}) | ||
} | ||
args.unshift(method, path) | ||
args.push(function (error: any, data: any) { | ||
@@ -97,6 +104,6 @@ return error ? reject(convert(error)) : resolve(data) | ||
this[_method] = function (data: any, params: Params = {}) { | ||
return this.send(method, data, params.query || {}) | ||
return this.send(method, data, params.query || {}, params.route || {}) | ||
} | ||
this[method] = function (data: any, params: Params = {}) { | ||
return this[_method](data, params) | ||
return this[_method](data, params, params.route || {}) | ||
} | ||
@@ -108,3 +115,3 @@ }) | ||
_find(params: Params = {}) { | ||
return this.send<T | T[]>('find', params.query || {}) | ||
return this.send<T | T[]>('find', params.query || {}, params.route || {}) | ||
} | ||
@@ -117,3 +124,3 @@ | ||
_get(id: Id, params: Params = {}) { | ||
return this.send<T>('get', id, params.query || {}) | ||
return this.send<T>('get', id, params.query || {}, params.route || {}) | ||
} | ||
@@ -126,3 +133,3 @@ | ||
_create(data: D, params: Params = {}) { | ||
return this.send<T>('create', data, params.query || {}) | ||
return this.send<T>('create', data, params.query || {}, params.route || {}) | ||
} | ||
@@ -138,3 +145,3 @@ | ||
} | ||
return this.send<T>('update', id, data, params.query || {}) | ||
return this.send<T>('update', id, data, params.query || {}, params.route || {}) | ||
} | ||
@@ -147,3 +154,3 @@ | ||
_patch(id: NullableId, data: D, params: Params = {}) { | ||
return this.send<T | T[]>('patch', id, data, params.query || {}) | ||
return this.send<T | T[]>('patch', id, data, params.query || {}, params.route || {}) | ||
} | ||
@@ -156,3 +163,3 @@ | ||
_remove(id: NullableId, params: Params = {}) { | ||
return this.send<T | T[]>('remove', id, params.query || {}) | ||
return this.send<T | T[]>('remove', id, params.query || {}, params.route || {}) | ||
} | ||
@@ -159,0 +166,0 @@ |
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
145115
1816
Updated@feathersjs/commons@^5.0.11
Updated@feathersjs/errors@^5.0.11
Updated@feathersjs/feathers@^5.0.11