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.
@@ -31416,6 +31416,18 @@ __webpack_require__.r(__webpack_exports__);
31416
31416
  /* harmony export */ });
31417
31417
  /* harmony import */ var lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isPlainObject.js */ "../node_modules/lodash/isPlainObject.js");
31418
31418
 
31419
+ function obscureHeaders(config) {
31420
+ // Management, Delivery and Preview API tokens
31421
+ if (config?.headers?.['Authorization']) {
31422
+ const token = `...${config.headers['Authorization'].toString().substr(-5)}`;
31423
+ config.headers['Authorization'] = `Bearer ${token}`;
31424
+ }
31425
+ // Encoded Delivery or Preview token map for Cross-Space References
31426
+ if (config?.headers?.['X-Contentful-Resource-Resolution']) {
31427
+ const token = `...${config.headers['X-Contentful-Resource-Resolution'].toString().substr(-5)}`;
31428
+ config.headers['X-Contentful-Resource-Resolution'] = token;
31429
+ }
31430
+ }
31419
31431
  /**
31420
31432
  * Handles errors received from the server. Parses the error into a more useful
31421
31433
  * format, places it in an exception and throws it.
@@ -31427,11 +31439,7 @@ __webpack_require__.r(__webpack_exports__);
31427
31439
  function errorHandler(errorResponse) {
31428
31440
  const { config, response } = errorResponse;
31429
31441
  let errorName;
31430
- // Obscure the Management token
31431
- if (config && config.headers && config.headers['Authorization']) {
31432
- const token = `...${config.headers['Authorization'].toString().substr(-5)}`;
31433
- config.headers['Authorization'] = `Bearer ${token}`;
31434
- }
31442
+ obscureHeaders(config);
31435
31443
  if (!lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__(response) || !lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__(config)) {
31436
31444
  throw errorResponse;
31437
31445
  }
@@ -32589,7 +32597,7 @@ function createClient(params, opts = {}) {
32589
32597
  const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
32590
32598
  const userAgent = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)(
32591
32599
  // @ts-expect-error
32592
- `${sdkMain}/${"11.49.0"}`, params.application, params.integration, params.feature);
32600
+ `${sdkMain}/${"11.50.1"}`, params.application, params.integration, params.feature);
32593
32601
  const adapter = (0,_create_adapter__WEBPACK_IMPORTED_MODULE_1__.createAdapter)(_objectSpread(_objectSpread({}, params), {}, {
32594
32602
  userAgent
32595
32603
  }));