@feathersjs/rest-client
Advanced tools
Comparing version 5.0.8 to 5.0.9
@@ -6,10 +6,12 @@ # 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) | ||
**Note:** Version bump only for package @feathersjs/rest-client | ||
### Bug Fixes | ||
- **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) | ||
**Note:** Version bump only for package @feathersjs/rest-client | ||
## [5.0.7](https://github.com/feathersjs/feathers/compare/v5.0.6...v5.0.7) (2023-07-14) | ||
@@ -19,6 +21,2 @@ | ||
## [5.0.6](https://github.com/feathersjs/feathers/compare/v5.0.5...v5.0.6) (2023-06-15) | ||
@@ -25,0 +23,0 @@ |
@@ -21,9 +21,15 @@ import { Params, Id, Query, NullableId, ServiceInterface } from '@feathersjs/feathers'; | ||
methods(this: any, ...names: string[]): any; | ||
_find(params?: P): any; | ||
find(params?: P): any; | ||
_get(id: Id, params?: P): any; | ||
get(id: Id, params?: P): any; | ||
create(body: D, params?: P): any; | ||
update(id: NullableId, body: D, params?: P): any; | ||
patch(id: NullableId, body: D, params?: P): any; | ||
_create(data: D, params?: P): any; | ||
create(data: D, params?: P): any; | ||
_update(id: NullableId, data: D, params?: P): any; | ||
update(id: NullableId, data: D, params?: P): any; | ||
_patch(id: NullableId, data: D, params?: P): any; | ||
patch(id: NullableId, data: D, params?: P): any; | ||
_remove(id: NullableId, params?: P): any; | ||
remove(id: NullableId, params?: P): any; | ||
} | ||
export {}; |
@@ -40,5 +40,6 @@ "use strict"; | ||
names.forEach((method) => { | ||
this[method] = function (body, params = {}) { | ||
const _method = `_${method}`; | ||
this[_method] = function (data, params = {}) { | ||
return this.request({ | ||
body, | ||
body: data, | ||
url: this.makeUrl(params.query), | ||
@@ -52,6 +53,9 @@ method: 'POST', | ||
}; | ||
this[method] = function (data, params = {}) { | ||
return this[_method](data, params); | ||
}; | ||
}); | ||
return this; | ||
} | ||
find(params) { | ||
_find(params) { | ||
return this.request({ | ||
@@ -63,3 +67,6 @@ url: this.makeUrl(params.query), | ||
} | ||
get(id, params) { | ||
find(params) { | ||
return this._find(params); | ||
} | ||
_get(id, params) { | ||
if (typeof id === 'undefined') { | ||
@@ -74,6 +81,9 @@ return Promise.reject(new Error("id for 'get' can not be undefined")); | ||
} | ||
create(body, params) { | ||
get(id, params) { | ||
return this._get(id, params); | ||
} | ||
_create(data, params) { | ||
return this.request({ | ||
url: this.makeUrl(params.query), | ||
body, | ||
body: data, | ||
method: 'POST', | ||
@@ -83,3 +93,6 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
} | ||
update(id, body, params) { | ||
create(data, params) { | ||
return this._create(data, params); | ||
} | ||
_update(id, data, params) { | ||
if (typeof id === 'undefined') { | ||
@@ -90,3 +103,3 @@ return Promise.reject(new Error("id for 'update' can not be undefined, only 'null' when updating multiple entries")); | ||
url: this.makeUrl(params.query, id), | ||
body, | ||
body: data, | ||
method: 'PUT', | ||
@@ -96,3 +109,6 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
} | ||
patch(id, body, params) { | ||
update(id, data, params) { | ||
return this._update(id, data, params); | ||
} | ||
_patch(id, data, params) { | ||
if (typeof id === 'undefined') { | ||
@@ -103,3 +119,3 @@ return Promise.reject(new Error("id for 'patch' can not be undefined, only 'null' when updating multiple entries")); | ||
url: this.makeUrl(params.query, id), | ||
body, | ||
body: data, | ||
method: 'PATCH', | ||
@@ -109,3 +125,6 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
} | ||
remove(id, params) { | ||
patch(id, data, params) { | ||
return this._patch(id, data, params); | ||
} | ||
_remove(id, params) { | ||
if (typeof id === 'undefined') { | ||
@@ -120,4 +139,7 @@ return Promise.reject(new Error("id for 'remove' can not be undefined, only 'null' when removing multiple entries")); | ||
} | ||
remove(id, params) { | ||
return this._remove(id, params); | ||
} | ||
} | ||
exports.Base = Base; | ||
//# sourceMappingURL=base.js.map |
{ | ||
"name": "@feathersjs/rest-client", | ||
"description": "REST client services for different Ajax libraries", | ||
"version": "5.0.8", | ||
"version": "5.0.9", | ||
"homepage": "https://feathersjs.com", | ||
@@ -56,17 +56,17 @@ "main": "lib/", | ||
"dependencies": { | ||
"@feathersjs/commons": "^5.0.8", | ||
"@feathersjs/errors": "^5.0.8", | ||
"@feathersjs/feathers": "^5.0.8", | ||
"@types/superagent": "^4.1.18", | ||
"@feathersjs/commons": "^5.0.9", | ||
"@feathersjs/errors": "^5.0.9", | ||
"@feathersjs/feathers": "^5.0.9", | ||
"@types/superagent": "^4.1.19", | ||
"qs": "^6.11.2" | ||
}, | ||
"devDependencies": { | ||
"@feathersjs/express": "^5.0.8", | ||
"@feathersjs/memory": "^5.0.8", | ||
"@feathersjs/tests": "^5.0.8", | ||
"@feathersjs/express": "^5.0.9", | ||
"@feathersjs/memory": "^5.0.9", | ||
"@feathersjs/tests": "^5.0.9", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^20.4.2", | ||
"@types/node-fetch": "^2.6.4", | ||
"@types/qs": "^6.9.7", | ||
"axios": "^1.4.0", | ||
"@types/node": "^20.7.0", | ||
"@types/node-fetch": "^2.6.6", | ||
"@types/qs": "^6.9.8", | ||
"axios": "^1.5.0", | ||
"mocha": "^10.2.0", | ||
@@ -76,7 +76,7 @@ "node-fetch": "^2.6.1", | ||
"shx": "^0.3.4", | ||
"superagent": "^8.0.9", | ||
"superagent": "^8.1.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
"typescript": "^5.2.2" | ||
}, | ||
"gitHead": "414336a047a556f1986b4bb253416d5b8a973d9f" | ||
"gitHead": "64ee98dadf02dac34f31e3cb7b6b10e1f7405bfa" | ||
} |
@@ -66,6 +66,7 @@ import qs from 'qs' | ||
names.forEach((method) => { | ||
this[method] = function (body: any, params: Params = {}) { | ||
const _method = `_${method}` | ||
this[_method] = function (data: any, params: Params = {}) { | ||
return this.request( | ||
{ | ||
body, | ||
body: data, | ||
url: this.makeUrl(params.query), | ||
@@ -84,2 +85,5 @@ method: 'POST', | ||
} | ||
this[method] = function (data: any, params: Params = {}) { | ||
return this[_method](data, params) | ||
} | ||
}) | ||
@@ -90,3 +94,3 @@ | ||
find(params?: P) { | ||
_find(params?: P) { | ||
return this.request( | ||
@@ -102,3 +106,7 @@ { | ||
get(id: Id, params?: P) { | ||
find(params?: P) { | ||
return this._find(params) | ||
} | ||
_get(id: Id, params?: P) { | ||
if (typeof id === 'undefined') { | ||
@@ -118,7 +126,11 @@ return Promise.reject(new Error("id for 'get' can not be undefined")) | ||
create(body: D, params?: P) { | ||
get(id: Id, params?: P) { | ||
return this._get(id, params) | ||
} | ||
_create(data: D, params?: P) { | ||
return this.request( | ||
{ | ||
url: this.makeUrl(params.query), | ||
body, | ||
body: data, | ||
method: 'POST', | ||
@@ -131,3 +143,7 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
update(id: NullableId, body: D, params?: P) { | ||
create(data: D, params?: P) { | ||
return this._create(data, params) | ||
} | ||
_update(id: NullableId, data: D, params?: P) { | ||
if (typeof id === 'undefined') { | ||
@@ -142,3 +158,3 @@ return Promise.reject( | ||
url: this.makeUrl(params.query, id), | ||
body, | ||
body: data, | ||
method: 'PUT', | ||
@@ -151,3 +167,7 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
patch(id: NullableId, body: D, params?: P) { | ||
update(id: NullableId, data: D, params?: P) { | ||
return this._update(id, data, params) | ||
} | ||
_patch(id: NullableId, data: D, params?: P) { | ||
if (typeof id === 'undefined') { | ||
@@ -162,3 +182,3 @@ return Promise.reject( | ||
url: this.makeUrl(params.query, id), | ||
body, | ||
body: data, | ||
method: 'PATCH', | ||
@@ -171,3 +191,7 @@ headers: Object.assign({ 'Content-Type': 'application/json' }, params.headers) | ||
remove(id: NullableId, params?: P) { | ||
patch(id: NullableId, data: D, params?: P) { | ||
return this._patch(id, data, params) | ||
} | ||
_remove(id: NullableId, params?: P) { | ||
if (typeof id === 'undefined') { | ||
@@ -188,2 +212,6 @@ return Promise.reject( | ||
} | ||
remove(id: NullableId, params?: P) { | ||
return this._remove(id, params) | ||
} | ||
} |
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
65462
684
Updated@feathersjs/commons@^5.0.9
Updated@feathersjs/errors@^5.0.9
Updated@feathersjs/feathers@^5.0.9
Updated@types/superagent@^4.1.19