contentful-management 11.61.0 → 11.61.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.
@@ -23649,79 +23649,124 @@ __webpack_require__.r(__webpack_exports__);
23649
23649
 
23650
23650
 
23651
23651
 
23652
+ /**
23653
+ * Known adapters mapping.
23654
+ * Provides environment-specific adapters for Axios:
23655
+ * - `http` for Node.js
23656
+ * - `xhr` for browsers
23657
+ * - `fetch` for fetch API-based requests
23658
+ *
23659
+ * @type {Object<string, Function|Object>}
23660
+ */
23652
23661
  const knownAdapters = {
23653
23662
  http: _http_js__WEBPACK_IMPORTED_MODULE_0__["default"],
23654
23663
  xhr: _xhr_js__WEBPACK_IMPORTED_MODULE_1__["default"],
23655
23664
  fetch: {
23656
23665
  get: _fetch_js__WEBPACK_IMPORTED_MODULE_2__.getFetch,
23657
23666
  }
23658
- }
23667
+ };
23659
23668
 
23669
+ // Assign adapter names for easier debugging and identification
23660
23670
  _utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].forEach(knownAdapters, (fn, value) => {
23661
23671
  if (fn) {
23662
23672
  try {
23663
- Object.defineProperty(fn, 'name', {value});
23673
+ Object.defineProperty(fn, 'name', { value });
23664
23674
  } catch (e) {
23665
23675
  // eslint-disable-next-line no-empty
23666
23676
  }
23667
- Object.defineProperty(fn, 'adapterName', {value});
23677
+ Object.defineProperty(fn, 'adapterName', { value });
23668
23678
  }
23669
23679
  });
23670
23680
 
23681
+ /**
23682
+ * Render a rejection reason string for unknown or unsupported adapters
23683
+ *
23684
+ * @param {string} reason
23685
+ * @returns {string}
23686
+ */
23671
23687
  const renderReason = (reason) => `- ${reason}`;
23672
23688
 
23689
+ /**
23690
+ * Check if the adapter is resolved (function, null, or false)
23691
+ *
23692
+ * @param {Function|null|false} adapter
23693
+ * @returns {boolean}
23694
+ */
23673
23695
  const isResolvedHandle = (adapter) => _utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].isFunction(adapter) || adapter === null || adapter === false;
23674
23696
 
23675
- /* harmony default export */ __webpack_exports__["default"] = ({
23676
- getAdapter: (adapters, config) => {
23677
- adapters = _utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].isArray(adapters) ? adapters : [adapters];
23678
-
23679
- const {length} = adapters;
23680
- let nameOrAdapter;
23681
- let adapter;
23697
+ /**
23698
+ * Get the first suitable adapter from the provided list.
23699
+ * Tries each adapter in order until a supported one is found.
23700
+ * Throws an AxiosError if no adapter is suitable.
23701
+ *
23702
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
23703
+ * @param {Object} config - Axios request configuration
23704
+ * @throws {AxiosError} If no suitable adapter is available
23705
+ * @returns {Function} The resolved adapter function
23706
+ */
23707
+ function getAdapter(adapters, config) {
23708
+ adapters = _utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].isArray(adapters) ? adapters : [adapters];
23682
23709
 
23683
- const rejectedReasons = {};
23710
+ const { length } = adapters;
23711
+ let nameOrAdapter;
23712
+ let adapter;
23684
23713
 
23685
- for (let i = 0; i < length; i++) {
23686
- nameOrAdapter = adapters[i];
23687
- let id;
23714
+ const rejectedReasons = {};
23688
23715
 
23689
- adapter = nameOrAdapter;
23716
+ for (let i = 0; i < length; i++) {
23717
+ nameOrAdapter = adapters[i];
23718
+ let id;
23690
23719
 
23691
- if (!isResolvedHandle(nameOrAdapter)) {
23692
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
23720
+ adapter = nameOrAdapter;
23693
23721
 
23694
- if (adapter === undefined) {
23695
- throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_4__["default"](`Unknown adapter '${id}'`);
23696
- }
23697
- }
23722
+ if (!isResolvedHandle(nameOrAdapter)) {
23723
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
23698
23724
 
23699
- if (adapter && (_utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].isFunction(adapter) || (adapter = adapter.get(config)))) {
23700
- break;
23725
+ if (adapter === undefined) {
23726
+ throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_4__["default"](`Unknown adapter '${id}'`);
23701
23727
  }
23728
+ }
23702
23729
 
23703
- rejectedReasons[id || '#' + i] = adapter;
23730
+ if (adapter && (_utils_js__WEBPACK_IMPORTED_MODULE_3__["default"].isFunction(adapter) || (adapter = adapter.get(config)))) {
23731
+ break;
23704
23732
  }
23705
23733
 
23706
- if (!adapter) {
23734
+ rejectedReasons[id || '#' + i] = adapter;
23735
+ }
23707
23736
 
23708
- const reasons = Object.entries(rejectedReasons)
23709
- .map(([id, state]) => `adapter ${id} ` +
23710
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
23711
- );
23737
+ if (!adapter) {
23738
+ const reasons = Object.entries(rejectedReasons)
23739
+ .map(([id, state]) => `adapter ${id} ` +
23740
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
23741
+ );
23712
23742
 
23713
- let s = length ?
23714
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
23715
- 'as no adapter specified';
23743
+ let s = length ?
23744
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
23745
+ 'as no adapter specified';
23716
23746
 
23717
- throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_4__["default"](
23718
- `There is no suitable adapter to dispatch the request ` + s,
23719
- 'ERR_NOT_SUPPORT'
23720
- );
23721
- }
23747
+ throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_4__["default"](
23748
+ `There is no suitable adapter to dispatch the request ` + s,
23749
+ 'ERR_NOT_SUPPORT'
23750
+ );
23751
+ }
23722
23752
 
23723
- return adapter;
23724
- },
23753
+ return adapter;
23754
+ }
23755
+
23756
+ /**
23757
+ * Exports Axios adapters and utility to resolve an adapter
23758
+ */
23759
+ /* harmony default export */ __webpack_exports__["default"] = ({
23760
+ /**
23761
+ * Resolve an adapter from a list of adapter names or functions.
23762
+ * @type {Function}
23763
+ */
23764
+ getAdapter,
23765
+
23766
+ /**
23767
+ * Exposes all known adapters
23768
+ * @type {Object<string, Function|Object>}
23769
+ */
23725
23770
  adapters: knownAdapters
23726
23771
  });
23727
23772
 
@@ -24012,7 +24057,7 @@ const factory = (env) => {
24012
24057
  const seedCache = new Map();
24013
24058
 
24014
24059
  const getFetch = (config) => {
24015
- let env = config ? config.env : {};
24060
+ let env = (config && config.env) || {};
24016
24061
  const {fetch, Request, Response} = env;
24017
24062
  const seeds = [
24018
24063
  Request, Response, fetch
@@ -25339,7 +25384,7 @@ class InterceptorManager {
25339
25384
  *
25340
25385
  * @param {Number} id The ID that was returned by `use`
25341
25386
  *
25342
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
25387
+ * @returns {void}
25343
25388
  */
25344
25389
  eject(id) {
25345
25390
  if (this.handlers[id]) {
@@ -25569,11 +25614,11 @@ function mergeConfig(config1, config2) {
25569
25614
  }
25570
25615
 
25571
25616
  // eslint-disable-next-line consistent-return
25572
- function mergeDeepProperties(a, b, prop , caseless) {
25617
+ function mergeDeepProperties(a, b, prop, caseless) {
25573
25618
  if (!_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isUndefined(b)) {
25574
- return getMergedValue(a, b, prop , caseless);
25619
+ return getMergedValue(a, b, prop, caseless);
25575
25620
  } else if (!_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isUndefined(a)) {
25576
- return getMergedValue(undefined, a, prop , caseless);
25621
+ return getMergedValue(undefined, a, prop, caseless);
25577
25622
  }
25578
25623
  }
25579
25624
 
@@ -25631,7 +25676,7 @@ function mergeConfig(config1, config2) {
25631
25676
  socketPath: defaultToConfig2,
25632
25677
  responseEncoding: defaultToConfig2,
25633
25678
  validateStatus: mergeDirectKeys,
25634
- headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
25679
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
25635
25680
  };
25636
25681
 
25637
25682
  _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
@@ -25945,7 +25990,7 @@ __webpack_require__.r(__webpack_exports__);
25945
25990
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25946
25991
  /* harmony export */ VERSION: function() { return /* binding */ VERSION; }
25947
25992
  /* harmony export */ });
25948
- const VERSION = "1.12.2";
25993
+ const VERSION = "1.13.0";
25949
25994
 
25950
25995
  /***/ }),
25951
25996
 
@@ -26092,6 +26137,12 @@ const HttpStatusCode = {
26092
26137
  LoopDetected: 508,
26093
26138
  NotExtended: 510,
26094
26139
  NetworkAuthenticationRequired: 511,
26140
+ WebServerIsDown: 521,
26141
+ ConnectionTimedOut: 522,
26142
+ OriginIsUnreachable: 523,
26143
+ TimeoutOccurred: 524,
26144
+ SslHandshakeFailed: 525,
26145
+ InvalidSslCertificate: 526,
26095
26146
  };
26096
26147
 
26097
26148
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
@@ -26116,6 +26167,13 @@ __webpack_require__.r(__webpack_exports__);
26116
26167
  /* harmony export */ });
26117
26168
 
26118
26169
 
26170
+ /**
26171
+ * Create a bound version of a function with a specified `this` context
26172
+ *
26173
+ * @param {Function} fn - The function to bind
26174
+ * @param {*} thisArg - The value to be passed as the `this` parameter
26175
+ * @returns {Function} A new function that will call the original function with the specified `this` context
26176
+ */
26119
26177
  function bind(fn, thisArg) {
26120
26178
  return function wrap() {
26121
26179
  return fn.apply(thisArg, arguments);
@@ -26319,27 +26377,38 @@ __webpack_require__.r(__webpack_exports__);
26319
26377
 
26320
26378
  // Standard browser envs support document.cookie
26321
26379
  {
26322
- write(name, value, expires, path, domain, secure) {
26323
- const cookie = [name + '=' + encodeURIComponent(value)];
26324
-
26325
- _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
26326
-
26327
- _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isString(path) && cookie.push('path=' + path);
26380
+ write(name, value, expires, path, domain, secure, sameSite) {
26381
+ if (typeof document === 'undefined') return;
26328
26382
 
26329
- _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isString(domain) && cookie.push('domain=' + domain);
26383
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
26330
26384
 
26331
- secure === true && cookie.push('secure');
26385
+ if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isNumber(expires)) {
26386
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
26387
+ }
26388
+ if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isString(path)) {
26389
+ cookie.push(`path=${path}`);
26390
+ }
26391
+ if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isString(domain)) {
26392
+ cookie.push(`domain=${domain}`);
26393
+ }
26394
+ if (secure === true) {
26395
+ cookie.push('secure');
26396
+ }
26397
+ if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isString(sameSite)) {
26398
+ cookie.push(`SameSite=${sameSite}`);
26399
+ }
26332
26400
 
26333
26401
  document.cookie = cookie.join('; ');
26334
26402
  },
26335
26403
 
26336
26404
  read(name) {
26337
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
26338
- return (match ? decodeURIComponent(match[3]) : null);
26405
+ if (typeof document === 'undefined') return null;
26406
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
26407
+ return match ? decodeURIComponent(match[1]) : null;
26339
26408
  },
26340
26409
 
26341
26410
  remove(name) {
26342
- this.write(name, '', Date.now() - 86400000);
26411
+ this.write(name, '', Date.now() - 86400000, '/');
26343
26412
  }
26344
26413
  }
26345
26414
 
@@ -29873,7 +29942,7 @@ function createClient(params) {
29873
29942
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29874
29943
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
29875
29944
  var userAgent = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)(// @ts-expect-error
29876
- "".concat(sdkMain, "/").concat("11.61.0"), params.application, params.integration, params.feature);
29945
+ "".concat(sdkMain, "/").concat("11.61.1"), params.application, params.integration, params.feature);
29877
29946
  var adapter = (0,_create_adapter__WEBPACK_IMPORTED_MODULE_1__.createAdapter)(_objectSpread(_objectSpread({}, params), {}, {
29878
29947
  userAgent: userAgent
29879
29948
  }));