rest-client-sdk 7.0.0-rc.4 → 7.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +67 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +67 -1
- package/dist/index.js.map +1 -1
- package/dist/types/ErrorFactory.d.ts +4 -0
- package/package.json +1 -1
- package/src/ErrorFactory.ts +7 -0
- package/src/client/AbstractClient.ts +3 -2
package/dist/index.es.js
CHANGED
|
@@ -17,6 +17,42 @@ function _typeof(obj) {
|
|
|
17
17
|
return _typeof(obj);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
21
|
+
try {
|
|
22
|
+
var info = gen[key](arg);
|
|
23
|
+
var value = info.value;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
reject(error);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (info.done) {
|
|
30
|
+
resolve(value);
|
|
31
|
+
} else {
|
|
32
|
+
Promise.resolve(value).then(_next, _throw);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _asyncToGenerator(fn) {
|
|
37
|
+
return function () {
|
|
38
|
+
var self = this,
|
|
39
|
+
args = arguments;
|
|
40
|
+
return new Promise(function (resolve, reject) {
|
|
41
|
+
var gen = fn.apply(self, args);
|
|
42
|
+
|
|
43
|
+
function _next(value) {
|
|
44
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _throw(err) {
|
|
48
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_next(undefined);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
20
56
|
function _classCallCheck(instance, Constructor) {
|
|
21
57
|
if (!(instance instanceof Constructor)) {
|
|
22
58
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -1219,6 +1255,36 @@ var HttpError = /*#__PURE__*/function (_Error) {
|
|
|
1219
1255
|
_this.baseResponse = baseResponse;
|
|
1220
1256
|
return _this;
|
|
1221
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Get the JSON of the baseResponse directly, if possible
|
|
1260
|
+
*/
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
_createClass(HttpError, [{
|
|
1264
|
+
key: "responseJson",
|
|
1265
|
+
value: function () {
|
|
1266
|
+
var _responseJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
1267
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1268
|
+
while (1) {
|
|
1269
|
+
switch (_context.prev = _context.next) {
|
|
1270
|
+
case 0:
|
|
1271
|
+
return _context.abrupt("return", this.baseResponse.json());
|
|
1272
|
+
|
|
1273
|
+
case 1:
|
|
1274
|
+
case "end":
|
|
1275
|
+
return _context.stop();
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}, _callee, this);
|
|
1279
|
+
}));
|
|
1280
|
+
|
|
1281
|
+
function responseJson() {
|
|
1282
|
+
return _responseJson.apply(this, arguments);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
return responseJson;
|
|
1286
|
+
}()
|
|
1287
|
+
}]);
|
|
1222
1288
|
|
|
1223
1289
|
return HttpError;
|
|
1224
1290
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
@@ -1824,7 +1890,7 @@ var AbstractClient = /*#__PURE__*/function () {
|
|
|
1824
1890
|
if (this.sdk.mapping.idPrefix) {
|
|
1825
1891
|
var segments = url.segment();
|
|
1826
1892
|
|
|
1827
|
-
if (
|
|
1893
|
+
if (!url.pathname().startsWith(this.sdk.mapping.idPrefix)) {
|
|
1828
1894
|
segments.unshift(this.sdk.mapping.idPrefix);
|
|
1829
1895
|
url.segment(segments);
|
|
1830
1896
|
}
|