@feathersjs/transport-commons
Advanced tools
Comparing version 5.0.8 to 5.0.9
@@ -6,13 +6,14 @@ # Change Log | ||
## [5.0.8](https://github.com/feathersjs/feathers/compare/v5.0.7...v5.0.8) (2023-07-19) | ||
## [5.0.9](https://github.com/feathersjs/feathers/compare/v5.0.8...v5.0.9) (2023-09-27) | ||
### 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)) | ||
- **client:** Add underscored methods to clients ([#3176](https://github.com/feathersjs/feathers/issues/3176)) ([f3c01f7](https://github.com/feathersjs/feathers/commit/f3c01f7b8266bfc642c55b77ba8e5bb333542630)) | ||
## [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) | ||
@@ -22,6 +23,2 @@ | ||
## [5.0.6](https://github.com/feathersjs/feathers/compare/v5.0.5...v5.0.6) (2023-06-15) | ||
@@ -28,0 +25,0 @@ |
@@ -17,7 +17,13 @@ import { Id, NullableId, Params, ServiceInterface } from '@feathersjs/feathers'; | ||
methods(this: any, ...names: string[]): any; | ||
_find(params?: Params): Promise<T | T[]>; | ||
find(params?: Params): Promise<T | T[]>; | ||
_get(id: Id, params?: Params): Promise<T>; | ||
get(id: Id, params?: Params): Promise<T>; | ||
create(data: any, params?: Params): Promise<T>; | ||
update(id: Id, data: any, params?: Params): Promise<T>; | ||
patch(id: NullableId, data: any, params?: Params): Promise<T | T[]>; | ||
_create(data: D, params?: Params): Promise<T>; | ||
create(data: D, params?: Params): Promise<T>; | ||
_update(id: NullableId, data: D, params?: Params): Promise<T>; | ||
update(id: NullableId, data: D, params?: Params): Promise<T>; | ||
_patch(id: NullableId, data: D, params?: Params): Promise<T | T[]>; | ||
patch(id: NullableId, data: D, params?: Params): Promise<T | T[]>; | ||
_remove(id: NullableId, params?: Params): Promise<T | T[]>; | ||
remove(id: NullableId, params?: Params): Promise<T | T[]>; | ||
@@ -24,0 +30,0 @@ off(name: string, ...args: any[]): any; |
@@ -64,27 +64,52 @@ "use strict"; | ||
methods(...names) { | ||
names.forEach((name) => { | ||
this[name] = function (data, params = {}) { | ||
return this.send(name, data, params.query || {}); | ||
names.forEach((method) => { | ||
const _method = `_${method}`; | ||
this[_method] = function (data, params = {}) { | ||
return this.send(method, data, params.query || {}); | ||
}; | ||
this[method] = function (data, params = {}) { | ||
return this[_method](data, params); | ||
}; | ||
}); | ||
return this; | ||
} | ||
find(params = {}) { | ||
_find(params = {}) { | ||
return this.send('find', params.query || {}); | ||
} | ||
get(id, params = {}) { | ||
find(params = {}) { | ||
return this._find(params); | ||
} | ||
_get(id, params = {}) { | ||
return this.send('get', id, params.query || {}); | ||
} | ||
create(data, params = {}) { | ||
get(id, params = {}) { | ||
return this._get(id, params); | ||
} | ||
_create(data, params = {}) { | ||
return this.send('create', data, params.query || {}); | ||
} | ||
update(id, data, params = {}) { | ||
create(data, params = {}) { | ||
return this._create(data, params); | ||
} | ||
_update(id, data, params = {}) { | ||
if (typeof id === 'undefined') { | ||
return Promise.reject(new Error("id for 'update' can not be undefined")); | ||
} | ||
return this.send('update', id, data, params.query || {}); | ||
} | ||
patch(id, data, params = {}) { | ||
update(id, data, params = {}) { | ||
return this._update(id, data, params); | ||
} | ||
_patch(id, data, params = {}) { | ||
return this.send('patch', id, data, params.query || {}); | ||
} | ||
remove(id, params = {}) { | ||
patch(id, data, params = {}) { | ||
return this._patch(id, data, params); | ||
} | ||
_remove(id, params = {}) { | ||
return this.send('remove', id, params.query || {}); | ||
} | ||
remove(id, params = {}) { | ||
return this._remove(id, params); | ||
} | ||
// `off` is actually not part of the Node event emitter spec | ||
@@ -91,0 +116,0 @@ // but we are adding it since everybody is expecting it because |
{ | ||
"name": "@feathersjs/transport-commons", | ||
"description": "Shared functionality for websocket providers", | ||
"version": "5.0.8", | ||
"version": "5.0.9", | ||
"homepage": "https://feathersjs.com", | ||
@@ -57,5 +57,5 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/commons": "^5.0.8", | ||
"@feathersjs/errors": "^5.0.8", | ||
"@feathersjs/feathers": "^5.0.8", | ||
"@feathersjs/commons": "^5.0.9", | ||
"@feathersjs/errors": "^5.0.9", | ||
"@feathersjs/feathers": "^5.0.9", | ||
"encodeurl": "^1.0.2", | ||
@@ -66,11 +66,11 @@ "lodash": "^4.17.21" | ||
"@types/encodeurl": "^1.0.0", | ||
"@types/lodash": "^4.14.195", | ||
"@types/lodash": "^4.14.199", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^20.4.2", | ||
"@types/node": "^20.7.0", | ||
"mocha": "^10.2.0", | ||
"shx": "^0.3.4", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
"typescript": "^5.2.2" | ||
}, | ||
"gitHead": "414336a047a556f1986b4bb253416d5b8a973d9f" | ||
"gitHead": "64ee98dadf02dac34f31e3cb7b6b10e1f7405bfa" | ||
} |
@@ -93,6 +93,10 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
methods(this: any, ...names: string[]) { | ||
names.forEach((name) => { | ||
this[name] = function (data: any, params: Params = {}) { | ||
return this.send(name, data, params.query || {}) | ||
names.forEach((method) => { | ||
const _method = `_${method}` | ||
this[_method] = function (data: any, params: Params = {}) { | ||
return this.send(method, data, params.query || {}) | ||
} | ||
this[method] = function (data: any, params: Params = {}) { | ||
return this[_method](data, params) | ||
} | ||
}) | ||
@@ -102,26 +106,53 @@ return this | ||
find(params: Params = {}) { | ||
_find(params: Params = {}) { | ||
return this.send<T | T[]>('find', params.query || {}) | ||
} | ||
get(id: Id, params: Params = {}) { | ||
find(params: Params = {}) { | ||
return this._find(params) | ||
} | ||
_get(id: Id, params: Params = {}) { | ||
return this.send<T>('get', id, params.query || {}) | ||
} | ||
create(data: any, params: Params = {}) { | ||
get(id: Id, params: Params = {}) { | ||
return this._get(id, params) | ||
} | ||
_create(data: D, params: Params = {}) { | ||
return this.send<T>('create', data, params.query || {}) | ||
} | ||
update(id: Id, data: any, params: Params = {}) { | ||
create(data: D, params: Params = {}) { | ||
return this._create(data, params) | ||
} | ||
_update(id: NullableId, data: D, params: Params = {}) { | ||
if (typeof id === 'undefined') { | ||
return Promise.reject(new Error("id for 'update' can not be undefined")) | ||
} | ||
return this.send<T>('update', id, data, params.query || {}) | ||
} | ||
patch(id: NullableId, data: any, params: Params = {}) { | ||
update(id: NullableId, data: D, params: Params = {}) { | ||
return this._update(id, data, params) | ||
} | ||
_patch(id: NullableId, data: D, params: Params = {}) { | ||
return this.send<T | T[]>('patch', id, data, params.query || {}) | ||
} | ||
remove(id: NullableId, params: Params = {}) { | ||
patch(id: NullableId, data: D, params: Params = {}) { | ||
return this._patch(id, data, params) | ||
} | ||
_remove(id: NullableId, params: Params = {}) { | ||
return this.send<T | T[]>('remove', id, params.query || {}) | ||
} | ||
remove(id: NullableId, params: Params = {}) { | ||
return this._remove(id, params) | ||
} | ||
// `off` is actually not part of the Node event emitter spec | ||
@@ -128,0 +159,0 @@ // but we are adding it since everybody is expecting it because |
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
143109
1802
Updated@feathersjs/commons@^5.0.9
Updated@feathersjs/errors@^5.0.9
Updated@feathersjs/feathers@^5.0.9