@jfront/core-rest
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -6,2 +6,30 @@ # Change Log | ||
# [0.2.0](https://github.com/Jepria/jfront-core/compare/@jfront/core-rest@0.1.4...@jfront/core-rest@0.2.0) (2021-03-17) | ||
### Bug Fixes | ||
* prevent errors if response is undefined ([6adca12](https://github.com/Jepria/jfront-core/commit/6adca1272d333f52c51d402df5404c1b79010640)) | ||
### Code Refactoring | ||
* dependencies updated ([2911f41](https://github.com/Jepria/jfront-core/commit/2911f419f59a32c538d8fdfce4788aaf90f5b676)) | ||
### Features | ||
* add ChildFeatureApi.ts ([d9a1ba4](https://github.com/Jepria/jfront-core/commit/d9a1ba48ec20294e4c54f5b33d2dda26061ecc82)) | ||
* search with query string and http get method ([4286229](https://github.com/Jepria/jfront-core/commit/4286229a56a4313fbe9ed55f886f03f09924a0d2)) | ||
* support for multilevel nesting ([e16a37f](https://github.com/Jepria/jfront-core/commit/e16a37f50190c670fb4a3f4032fd213cf77369fa)) | ||
### BREAKING CHANGES | ||
* react 17.0.1 | ||
## [0.1.4](https://github.com/Jepria/jfront-core/compare/@jfront/core-rest@0.1.3...@jfront/core-rest@0.1.4) (2021-02-03) | ||
@@ -8,0 +36,0 @@ |
@@ -12,4 +12,6 @@ "use strict"; | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -48,3 +50,3 @@ | ||
}).then(function (response) { | ||
if (response.status === 201) { | ||
if ((response == null ? void 0 : response.status) === 201) { | ||
var location = response.headers["location"]; | ||
@@ -59,3 +61,3 @@ | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -92,3 +94,3 @@ } else { | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
if (getRecordById) { | ||
@@ -101,3 +103,3 @@ _this.axios.get(_this.baseUrl + ("/" + id), { | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -130,3 +132,3 @@ } else { | ||
}).then(function (response) { | ||
response.status === 200 ? resolve() : reject((0, _Errors.buildError)(response)); | ||
(response == null ? void 0 : response.status) === 200 ? resolve() : reject((0, _Errors.buildError)(response)); | ||
})["catch"](function (error) { | ||
@@ -146,3 +148,3 @@ return reject((0, _Errors.handleAxiosError)(error)); | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -149,0 +151,0 @@ } else { |
@@ -12,4 +12,6 @@ "use strict"; | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -49,3 +51,3 @@ | ||
}).then(function (response) { | ||
if (response.status === 201) { | ||
if ((response == null ? void 0 : response.status) === 201) { | ||
var location = response.headers["location"]; | ||
@@ -62,3 +64,3 @@ resolve(location.split("/").pop()); | ||
_defineProperty(_assertThisInitialized(_this), "search", function (searchId, pageSize, page, cacheControl) { | ||
_defineProperty(_assertThisInitialized(_this), "search", function (query, cacheControl) { | ||
if (cacheControl === void 0) { | ||
@@ -69,2 +71,26 @@ cacheControl = "no-cache"; | ||
return new Promise(function (resolve, reject) { | ||
_this.axios.get(_this.baseUrl + ("/search?" + query), { | ||
headers: { | ||
Accept: "application/json;charset=utf-8", | ||
"Content-Type": "application/json;charset=utf-8", | ||
"Cache-Control": cacheControl | ||
} | ||
}).then(function (response) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
} else { | ||
reject((0, _Errors.buildError)(response)); | ||
} | ||
})["catch"](function (error) { | ||
return reject((0, _Errors.handleAxiosError)(error)); | ||
}); | ||
}); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getResultSet", function (searchId, pageSize, page, cacheControl) { | ||
if (cacheControl === void 0) { | ||
cacheControl = "no-cache"; | ||
} | ||
return new Promise(function (resolve, reject) { | ||
_this.axios.get(_this.baseUrl + ("/search/" + searchId + "/resultset?pageSize=" + pageSize + "&page=" + page), { | ||
@@ -77,5 +103,5 @@ headers: { | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
} else if (response.status === 204) { | ||
} else if ((response == null ? void 0 : response.status) === 204) { | ||
resolve([]); | ||
@@ -104,3 +130,3 @@ } else { | ||
}).then(function (response) { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -107,0 +133,0 @@ } else { |
@@ -96,3 +96,3 @@ "use strict"; | ||
errorCode: (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.errorCode) || (response == null ? void 0 : response.status), | ||
errorMessage: response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : _response$data3.errorMessage | ||
errorMessage: (response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : _response$data3.errorMessage) || (response == null ? void 0 : response.data) | ||
}; | ||
@@ -99,0 +99,0 @@ break; |
@@ -44,2 +44,10 @@ "use strict"; | ||
}); | ||
var _ConnectorChield = require("./api/ConnectorChield"); | ||
Object.keys(_ConnectorChield).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _ConnectorChield[key]) return; | ||
exports[key] = _ConnectorChield[key]; | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -32,3 +32,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
}).then(response => { | ||
if (response.status === 201) { | ||
if ((response == null ? void 0 : response.status) === 201) { | ||
var location = response.headers["location"]; | ||
@@ -43,3 +43,3 @@ | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -72,3 +72,3 @@ } else { | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
if (getRecordById) { | ||
@@ -81,3 +81,3 @@ _this.axios.get(_this.baseUrl + ("/" + id), { | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -106,3 +106,3 @@ } else { | ||
}).then(response => { | ||
response.status === 200 ? resolve() : reject(buildError(response)); | ||
(response == null ? void 0 : response.status) === 200 ? resolve() : reject(buildError(response)); | ||
}).catch(error => reject(handleAxiosError(error))); | ||
@@ -120,3 +120,3 @@ }); | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -123,0 +123,0 @@ } else { |
@@ -33,3 +33,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
}).then(response => { | ||
if (response.status === 201) { | ||
if ((response == null ? void 0 : response.status) === 201) { | ||
var location = response.headers["location"]; | ||
@@ -44,3 +44,3 @@ resolve(location.split("/").pop()); | ||
_defineProperty(this, "search", function (searchId, pageSize, page, cacheControl) { | ||
_defineProperty(this, "search", function (query, cacheControl) { | ||
if (cacheControl === void 0) { | ||
@@ -51,2 +51,24 @@ cacheControl = "no-cache"; | ||
return new Promise((resolve, reject) => { | ||
_this.axios.get(_this.baseUrl + ("/search?" + query), { | ||
headers: { | ||
Accept: "application/json;charset=utf-8", | ||
"Content-Type": "application/json;charset=utf-8", | ||
"Cache-Control": cacheControl | ||
} | ||
}).then(response => { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
} else { | ||
reject(buildError(response)); | ||
} | ||
}).catch(error => reject(handleAxiosError(error))); | ||
}); | ||
}); | ||
_defineProperty(this, "getResultSet", function (searchId, pageSize, page, cacheControl) { | ||
if (cacheControl === void 0) { | ||
cacheControl = "no-cache"; | ||
} | ||
return new Promise((resolve, reject) => { | ||
_this.axios.get(_this.baseUrl + ("/search/" + searchId + "/resultset?pageSize=" + pageSize + "&page=" + page), { | ||
@@ -59,5 +81,5 @@ headers: { | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
} else if (response.status === 204) { | ||
} else if ((response == null ? void 0 : response.status) === 204) { | ||
resolve([]); | ||
@@ -84,3 +106,3 @@ } else { | ||
}).then(response => { | ||
if (response.status === 200) { | ||
if ((response == null ? void 0 : response.status) === 200) { | ||
resolve(response.data); | ||
@@ -87,0 +109,0 @@ } else { |
@@ -88,3 +88,3 @@ import { ACCESS_DENIED, AUTHORIZATION_FAILED, BAD_REQUEST, NOT_FOUND, SERVER_ERROR } from "./types"; | ||
errorCode: (response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.errorCode) || (response == null ? void 0 : response.status), | ||
errorMessage: response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : _response$data3.errorMessage | ||
errorMessage: (response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : _response$data3.errorMessage) || (response == null ? void 0 : response.data) | ||
}; | ||
@@ -91,0 +91,0 @@ break; |
@@ -6,2 +6,3 @@ export * from "./api/Errors"; | ||
export * from "./api/ConnectorSearch"; | ||
export * from "./api/ConnectorChield"; | ||
//# sourceMappingURL=index.js.map |
import { ConnectorBase } from "./ConnectorBase"; | ||
import { SearchRequest } from "./types"; | ||
import { ResultSet, SearchRequest } from "./types"; | ||
/** | ||
@@ -17,3 +17,9 @@ * Standard jepria-rest Search RESTful API connector. | ||
/** | ||
* Search request. | ||
* Search values by query | ||
* @param {string} query search query string e.g. "field1=text1&field2=text2" | ||
* @param {string} cacheControl Cache-control header value | ||
*/ | ||
search: (query: string, cacheControl?: string) => Promise<ResultSet<Dto>>; | ||
/** | ||
* Get resultset by searchId. | ||
* @param {string} searchId search template id | ||
@@ -24,3 +30,3 @@ * @param {number} pageSize page size | ||
*/ | ||
search: (searchId: string, pageSize: number, page: number, cacheControl?: string) => Promise<Array<Dto>>; | ||
getResultSet: (searchId: string, pageSize: number, page: number, cacheControl?: string) => Promise<Array<Dto>>; | ||
/** | ||
@@ -27,0 +33,0 @@ * Search resultset size request. |
@@ -45,1 +45,5 @@ export declare const BAD_REQUEST = 400; | ||
}; | ||
export declare type ResultSet<Entity> = { | ||
resultsetSize: number; | ||
data: Entity[]; | ||
}; |
@@ -6,1 +6,2 @@ export * from "./api/Errors"; | ||
export * from "./api/ConnectorSearch"; | ||
export * from "./api/ConnectorChield"; |
{ | ||
"name": "@jfront/core-rest", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"license": "Apache-2.0", | ||
@@ -27,13 +27,6 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"dependencies": { | ||
"axios": "0.20.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "16.x", | ||
"react-dom": "16.x" | ||
"axios": "^0.21.1" | ||
}, | ||
"devDependencies": { | ||
"@types/styled-components": "^5.0.1" | ||
}, | ||
"gitHead": "25689510919b29dbdbe122f1b152797f27309df4" | ||
"gitHead": "a3b37ba23f7034943f6488ebb854614671dcda2e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
143305
1
0
38
1316
+ Addedaxios@0.21.4(transitive)
- Removedaxios@0.20.0
- Removedaxios@0.20.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedscheduler@0.19.1(transitive)