contentful-management 11.49.0 → 11.50.1

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.
@@ -28096,6 +28096,18 @@ __webpack_require__.r(__webpack_exports__);
28096
28096
  /* harmony export */ });
28097
28097
  /* harmony import */ var lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isPlainObject.js */ "../node_modules/lodash/isPlainObject.js");
28098
28098
 
28099
+ function obscureHeaders(config) {
28100
+ // Management, Delivery and Preview API tokens
28101
+ if (config?.headers?.['Authorization']) {
28102
+ const token = `...${config.headers['Authorization'].toString().substr(-5)}`;
28103
+ config.headers['Authorization'] = `Bearer ${token}`;
28104
+ }
28105
+ // Encoded Delivery or Preview token map for Cross-Space References
28106
+ if (config?.headers?.['X-Contentful-Resource-Resolution']) {
28107
+ const token = `...${config.headers['X-Contentful-Resource-Resolution'].toString().substr(-5)}`;
28108
+ config.headers['X-Contentful-Resource-Resolution'] = token;
28109
+ }
28110
+ }
28099
28111
  /**
28100
28112
  * Handles errors received from the server. Parses the error into a more useful
28101
28113
  * format, places it in an exception and throws it.
@@ -28107,11 +28119,7 @@ __webpack_require__.r(__webpack_exports__);
28107
28119
  function errorHandler(errorResponse) {
28108
28120
  const { config, response } = errorResponse;
28109
28121
  let errorName;
28110
- // Obscure the Management token
28111
- if (config && config.headers && config.headers['Authorization']) {
28112
- const token = `...${config.headers['Authorization'].toString().substr(-5)}`;
28113
- config.headers['Authorization'] = `Bearer ${token}`;
28114
- }
28122
+ obscureHeaders(config);
28115
28123
  if (!lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__(response) || !lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__(config)) {
28116
28124
  throw errorResponse;
28117
28125
  }
@@ -29268,7 +29276,7 @@ function createClient(params) {
29268
29276
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29269
29277
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
29270
29278
  var userAgent = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)(// @ts-expect-error
29271
- "".concat(sdkMain, "/").concat("11.49.0"), params.application, params.integration, params.feature);
29279
+ "".concat(sdkMain, "/").concat("11.50.1"), params.application, params.integration, params.feature);
29272
29280
  var adapter = (0,_create_adapter__WEBPACK_IMPORTED_MODULE_1__.createAdapter)(_objectSpread(_objectSpread({}, params), {}, {
29273
29281
  userAgent: userAgent
29274
29282
  }));