contentful-management 7.5.1 → 7.6.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## [7.5.1](https://github.com/contentful/contentful-management.js/compare/v7.5.0...v7.5.1) (2020-12-17)
1
+ # [7.6.0](https://github.com/contentful/contentful-management.js/compare/v7.5.4...v7.6.0) (2021-02-02)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * allow required headers to be overwritten by custom ones ([#609](https://github.com/contentful/contentful-management.js/issues/609)) ([73e95ce](https://github.com/contentful/contentful-management.js/commit/73e95ce0db745decff1bee7a3ed07d9e4c9f9540))
6
+ * **getCurrentUser:** allow for query params and type to be passed ([#667](https://github.com/contentful/contentful-management.js/issues/667)) ([e8681f9](https://github.com/contentful/contentful-management.js/commit/e8681f99bcd54b8f34c3f42b32eb78efa02d6a29))
@@ -355,6 +355,9 @@ axios.all = function all(promises) {
355
355
  };
356
356
  axios.spread = __webpack_require__(/*! ./helpers/spread */ "../node_modules/axios/lib/helpers/spread.js");
357
357
 
358
+ // Expose isAxiosError
359
+ axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "../node_modules/axios/lib/helpers/isAxiosError.js");
360
+
358
361
  module.exports = axios;
359
362
 
360
363
  // Allow use of default import syntax in TypeScript
@@ -1357,6 +1360,29 @@ module.exports = function isAbsoluteURL(url) {
1357
1360
  };
1358
1361
 
1359
1362
 
1363
+ /***/ }),
1364
+
1365
+ /***/ "../node_modules/axios/lib/helpers/isAxiosError.js":
1366
+ /*!*********************************************************!*\
1367
+ !*** ../node_modules/axios/lib/helpers/isAxiosError.js ***!
1368
+ \*********************************************************/
1369
+ /*! no static exports found */
1370
+ /***/ (function(module, exports, __webpack_require__) {
1371
+
1372
+ "use strict";
1373
+
1374
+
1375
+ /**
1376
+ * Determines whether the payload is an error thrown by Axios
1377
+ *
1378
+ * @param {*} payload The value to test
1379
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
1380
+ */
1381
+ module.exports = function isAxiosError(payload) {
1382
+ return (typeof payload === 'object') && (payload.isAxiosError === true);
1383
+ };
1384
+
1385
+
1360
1386
  /***/ }),
1361
1387
 
1362
1388
  /***/ "../node_modules/axios/lib/helpers/isURLSameOrigin.js":
@@ -2885,8 +2911,7 @@ function toPlainObject(data) {
2885
2911
  }
2886
2912
  // blobs
2887
2913
  if (realm.Blob && object instanceof realm.Blob) {
2888
- clone = new Blob([object], { type: object.type });
2889
- return clone;
2914
+ return object.slice(0, object.size, object.type);
2890
2915
  }
2891
2916
  // buffers (node-only)
2892
2917
  if (realm.Buffer && realm.Buffer.isBuffer(object)) {
@@ -2929,6 +2954,10 @@ function toPlainObject(data) {
2929
2954
  };
2930
2955
  return handleCopy(object, createCache());
2931
2956
  }
2957
+ // Adding reference to allow usage in CommonJS libraries compiled using TSC, which
2958
+ // expects there to be a default property on the exported object. See
2959
+ // [#37](https://github.com/planttheidea/fast-copy/issues/37) for details.
2960
+ copy.default = copy;
2932
2961
  /**
2933
2962
  * @function strictCopy
2934
2963
  *
@@ -4335,7 +4364,7 @@ function createCMAHttpClient(params) {
4335
4364
  var plainClient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4336
4365
  var sdkMain = plainClient ? 'contentful-management-plain.js' : 'contentful-management.js';
4337
4366
  var userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])( // @ts-expect-error
4338
- "".concat(sdkMain, "/").concat("7.5.1"), params.application, params.integration, params.feature);
4367
+ "".concat(sdkMain, "/").concat("7.6.0"), params.application, params.integration, params.feature);
4339
4368
  var requiredHeaders = {
4340
4369
  'Content-Type': 'application/vnd.contentful.management.v1+json',
4341
4370
  'X-Contentful-User-Agent': userAgentHeader
@@ -4521,8 +4550,8 @@ function createClientApi(_ref) {
4521
4550
  * .catch(console.error)
4522
4551
  * ```
4523
4552
  */
4524
- getCurrentUser: function getCurrentUser() {
4525
- return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http).then(function (data) {
4553
+ getCurrentUser: function getCurrentUser(params) {
4554
+ return _plain_endpoints__WEBPACK_IMPORTED_MODULE_3__["user"].getCurrent(http, params).then(function (data) {
4526
4555
  return wrapUser(http, data);
4527
4556
  });
4528
4557
  },
@@ -9761,7 +9790,7 @@ function errorHandler(errorResponse) {
9761
9790
  response = errorResponse.response;
9762
9791
  var errorName; // Obscure the Management token
9763
9792
 
9764
- if (config.headers && config.headers['Authorization']) {
9793
+ if (config && config.headers && config.headers['Authorization']) {
9765
9794
  var token = "...".concat(config.headers['Authorization'].substr(-5));
9766
9795
  config.headers['Authorization'] = "Bearer ".concat(token);
9767
9796
  }
@@ -12013,8 +12042,10 @@ __webpack_require__.r(__webpack_exports__);
12013
12042
  var getForSpace = function getForSpace(http, params) {
12014
12043
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/users/").concat(params.userId));
12015
12044
  };
12016
- var getCurrent = function getCurrent(http) {
12017
- return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/users/me");
12045
+ var getCurrent = function getCurrent(http, params) {
12046
+ return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/users/me", {
12047
+ params: params === null || params === void 0 ? void 0 : params.query
12048
+ });
12018
12049
  };
12019
12050
  var getManyForSpace = function getManyForSpace(http, params) {
12020
12051
  return _raw__WEBPACK_IMPORTED_MODULE_0__["get"](http, "/spaces/".concat(params.spaceId, "/users"), {