rest-client-sdk 7.0.0-rc.9 → 7.0.0

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.js CHANGED
@@ -22,42 +22,6 @@
22
22
  return _typeof(obj);
23
23
  }
24
24
 
25
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
26
- try {
27
- var info = gen[key](arg);
28
- var value = info.value;
29
- } catch (error) {
30
- reject(error);
31
- return;
32
- }
33
-
34
- if (info.done) {
35
- resolve(value);
36
- } else {
37
- Promise.resolve(value).then(_next, _throw);
38
- }
39
- }
40
-
41
- function _asyncToGenerator(fn) {
42
- return function () {
43
- var self = this,
44
- args = arguments;
45
- return new Promise(function (resolve, reject) {
46
- var gen = fn.apply(self, args);
47
-
48
- function _next(value) {
49
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
50
- }
51
-
52
- function _throw(err) {
53
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
54
- }
55
-
56
- _next(undefined);
57
- });
58
- };
59
- }
60
-
61
25
  function _classCallCheck(instance, Constructor) {
62
26
  if (!(instance instanceof Constructor)) {
63
27
  throw new TypeError("Cannot call a class as a function");
@@ -444,28 +408,9 @@
444
408
 
445
409
  _createClass(HttpError, [{
446
410
  key: "responseJson",
447
- value: function () {
448
- var _responseJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
449
- return regeneratorRuntime.wrap(function _callee$(_context) {
450
- while (1) {
451
- switch (_context.prev = _context.next) {
452
- case 0:
453
- return _context.abrupt("return", this.baseResponse.json());
454
-
455
- case 1:
456
- case "end":
457
- return _context.stop();
458
- }
459
- }
460
- }, _callee, this);
461
- }));
462
-
463
- function responseJson() {
464
- return _responseJson.apply(this, arguments);
465
- }
466
-
467
- return responseJson;
468
- }()
411
+ value: function responseJson() {
412
+ return this.baseResponse.json();
413
+ }
469
414
  }]);
470
415
 
471
416
  return HttpError;
@@ -1148,9 +1093,6 @@
1148
1093
  var queryParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1149
1094
  var pathParameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1150
1095
  var requestParams = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1151
-
1152
- this._throwIfUnitOfWorkIsDisabled();
1153
-
1154
1096
  var url = new URI(this.getPathBase(pathParameters));
1155
1097
  url.addSearch(queryParam);
1156
1098
  var oldSerializedModel = this.metadata.getDefaultSerializedModel();
@@ -1174,9 +1116,6 @@
1174
1116
  value: function update(entity) {
1175
1117
  var queryParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1176
1118
  var requestParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1177
-
1178
- this._throwIfUnitOfWorkIsDisabled();
1179
-
1180
1119
  var url = new URI(this.getEntityURI(entity));
1181
1120
  url.addSearch(queryParam);
1182
1121
  var newSerializedModel = this.serializer.normalizeItem(entity, this.metadata);
@@ -1211,9 +1150,6 @@
1211
1150
  var _this = this;
1212
1151
 
1213
1152
  var requestParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1214
-
1215
- this._throwIfUnitOfWorkIsDisabled();
1216
-
1217
1153
  var url = this.getEntityURI(entity);
1218
1154
 
1219
1155
  var identifier = this._getEntityIdentifier(entity);
@@ -1438,9 +1374,13 @@
1438
1374
  var _this6 = this;
1439
1375
 
1440
1376
  var params = requestParams;
1441
- var baseHeaders = {
1442
- 'Content-Type': 'application/json'
1443
- };
1377
+ var baseHeaders = {};
1378
+
1379
+ if (params.method !== 'GET' || params.method !== 'GET' && params.method !== 'DELETE') {
1380
+ baseHeaders = {
1381
+ 'Content-Type': 'application/json'
1382
+ };
1383
+ }
1444
1384
 
1445
1385
  if (accessToken) {
1446
1386
  baseHeaders.Authorization = "".concat(this.sdk.config.authorizationType, " ").concat(accessToken);
@@ -1496,13 +1436,6 @@
1496
1436
 
1497
1437
  return object[idKey];
1498
1438
  }
1499
- }, {
1500
- key: "_throwIfUnitOfWorkIsDisabled",
1501
- value: function _throwIfUnitOfWorkIsDisabled() {
1502
- if (!_classPrivateFieldGet(this, _isUnitOfWorkEnabled)) {
1503
- throw new Error('UnitOfWork can be deactivated only on find* methods (for now). If you think this should be authorized, please report in https://git.io/JkYTO');
1504
- }
1505
- }
1506
1439
  }]);
1507
1440
 
1508
1441
  return AbstractClient;