contentful 11.2.4 → 11.2.6

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.
@@ -13874,6 +13874,7 @@ function _interopDefaultLegacy(e) {
13874
13874
  }
13875
13875
  const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
13876
13876
  const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
13877
+ const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
13877
13878
  const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
13878
13879
  const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
13879
13880
  const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
@@ -14918,7 +14919,7 @@ function encode$2(val) {
14918
14919
  *
14919
14920
  * @param {string} url The base of the url (e.g., http://www.google.com)
14920
14921
  * @param {object} [params] The params to be appended
14921
- * @param {?object} options
14922
+ * @param {?(object|Function)} options
14922
14923
  *
14923
14924
  * @returns {string} The formatted url
14924
14925
  */
@@ -14928,6 +14929,11 @@ function buildURL(url, params, options) {
14928
14929
  return url;
14929
14930
  }
14930
14931
  const _encode = options && options.encode || encode$2;
14932
+ if (utils$1$1.isFunction(options)) {
14933
+ options = {
14934
+ serialize: options
14935
+ };
14936
+ }
14931
14937
  const serializeFn = options && options.serialize;
14932
14938
  let serializedParams;
14933
14939
  if (serializeFn) {
@@ -15644,7 +15650,7 @@ function buildFullPath(baseURL, requestedURL) {
15644
15650
  }
15645
15651
  return requestedURL;
15646
15652
  }
15647
- const VERSION = "1.7.7";
15653
+ const VERSION = "1.7.9";
15648
15654
  function parseProtocol(url) {
15649
15655
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
15650
15656
  return match && match[1] || '';
@@ -15823,7 +15829,7 @@ const readBlob = /*#__PURE__*/function () {
15823
15829
  }();
15824
15830
  const readBlob$1 = readBlob;
15825
15831
  const BOUNDARY_ALPHABET = utils$1$1.ALPHABET.ALPHA_DIGIT + '-_';
15826
- const textEncoder = new util.TextEncoder();
15832
+ const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default["default"].TextEncoder();
15827
15833
  const CRLF = '\r\n';
15828
15834
  const CRLF_BYTES = textEncoder.encode(CRLF);
15829
15835
  const CRLF_BYTES_COUNT = 2;
@@ -16104,7 +16110,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
16104
16110
  function setProxy(options, configProxy, location) {
16105
16111
  let proxy = configProxy;
16106
16112
  if (!proxy && proxy !== false) {
16107
- const proxyUrl = proxyFromEnv.getProxyForUrl(location);
16113
+ const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location);
16108
16114
  if (proxyUrl) {
16109
16115
  proxy = new URL(proxyUrl);
16110
16116
  }
@@ -16313,7 +16319,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
16313
16319
  /*eslint no-empty:0*/
16314
16320
  } catch (e) {}
16315
16321
  }
16316
- } else if (utils$1$1.isBlob(data)) {
16322
+ } else if (utils$1$1.isBlob(data) || utils$1$1.isFile(data)) {
16317
16323
  data.size && headers.setContentType(data.type || 'application/octet-stream');
16318
16324
  headers.setContentLength(data.size || 0);
16319
16325
  data = stream__default["default"].Readable.from(readBlob$1(data));
@@ -16513,7 +16519,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
16513
16519
  if (rejected) {
16514
16520
  return;
16515
16521
  }
16516
- const err = new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, lastRequest);
16522
+ const err = new AxiosError('stream has been aborted', AxiosError.ERR_BAD_RESPONSE, config, lastRequest);
16517
16523
  responseStream.destroy(err);
16518
16524
  reject(err);
16519
16525
  });
@@ -16610,60 +16616,10 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
16610
16616
  }
16611
16617
  });
16612
16618
  };
16613
- const isURLSameOrigin = platform.hasStandardBrowserEnv ?
16614
- // Standard browser envs have full support of the APIs needed to test
16615
- // whether the request URL is of the same origin as current location.
16616
- function standardBrowserEnv() {
16617
- const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
16618
- const urlParsingNode = document.createElement('a');
16619
- let originURL;
16620
-
16621
- /**
16622
- * Parse a URL to discover its components
16623
- *
16624
- * @param {String} url The URL to be parsed
16625
- * @returns {Object}
16626
- */
16627
- function resolveURL(url) {
16628
- let href = url;
16629
- if (msie) {
16630
- // IE needs attribute set twice to normalize properties
16631
- urlParsingNode.setAttribute('href', href);
16632
- href = urlParsingNode.href;
16633
- }
16634
- urlParsingNode.setAttribute('href', href);
16635
-
16636
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
16637
- return {
16638
- href: urlParsingNode.href,
16639
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
16640
- host: urlParsingNode.host,
16641
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
16642
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
16643
- hostname: urlParsingNode.hostname,
16644
- port: urlParsingNode.port,
16645
- pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
16646
- };
16647
- }
16648
- originURL = resolveURL(window.location.href);
16649
-
16650
- /**
16651
- * Determine if a URL shares the same origin as the current location
16652
- *
16653
- * @param {String} requestURL The URL to test
16654
- * @returns {boolean} True if URL shares the same origin, otherwise false
16655
- */
16656
- return function isURLSameOrigin(requestURL) {
16657
- const parsed = utils$1$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
16658
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
16659
- };
16660
- }() :
16661
- // Non standard browser envs (web workers, react-native) lack needed support.
16662
- function nonStandardBrowserEnv() {
16663
- return function isURLSameOrigin() {
16664
- return true;
16665
- };
16666
- }();
16619
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => url => {
16620
+ url = new URL(url, platform.origin);
16621
+ return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
16622
+ })(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : () => true;
16667
16623
  const cookies = platform.hasStandardBrowserEnv ?
16668
16624
  // Standard browser envs support document.cookie
16669
16625
  {
@@ -16706,7 +16662,7 @@ function mergeConfig(config1, config2) {
16706
16662
  // eslint-disable-next-line no-param-reassign
16707
16663
  config2 = config2 || {};
16708
16664
  const config = {};
16709
- function getMergedValue(target, source, caseless) {
16665
+ function getMergedValue(target, source, prop, caseless) {
16710
16666
  if (utils$1$1.isPlainObject(target) && utils$1$1.isPlainObject(source)) {
16711
16667
  return utils$1$1.merge.call({
16712
16668
  caseless
@@ -16720,11 +16676,11 @@ function mergeConfig(config1, config2) {
16720
16676
  }
16721
16677
 
16722
16678
  // eslint-disable-next-line consistent-return
16723
- function mergeDeepProperties(a, b, caseless) {
16679
+ function mergeDeepProperties(a, b, prop, caseless) {
16724
16680
  if (!utils$1$1.isUndefined(b)) {
16725
- return getMergedValue(a, b, caseless);
16681
+ return getMergedValue(a, b, prop, caseless);
16726
16682
  } else if (!utils$1$1.isUndefined(a)) {
16727
- return getMergedValue(undefined, a, caseless);
16683
+ return getMergedValue(undefined, a, prop, caseless);
16728
16684
  }
16729
16685
  }
16730
16686
 
@@ -16781,7 +16737,7 @@ function mergeConfig(config1, config2) {
16781
16737
  socketPath: defaultToConfig2,
16782
16738
  responseEncoding: defaultToConfig2,
16783
16739
  validateStatus: mergeDirectKeys,
16784
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
16740
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
16785
16741
  };
16786
16742
  utils$1$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
16787
16743
  const merge = mergeMap[prop] || mergeDeepProperties;
@@ -17450,6 +17406,13 @@ validators$1.transitional = function transitional(validator, version, message) {
17450
17406
  return validator ? validator(value, opt, opts) : true;
17451
17407
  };
17452
17408
  };
17409
+ validators$1.spelling = function spelling(correctSpelling) {
17410
+ return (value, opt) => {
17411
+ // eslint-disable-next-line no-console
17412
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
17413
+ return true;
17414
+ };
17415
+ };
17453
17416
 
17454
17417
  /**
17455
17418
  * Assert object's properties type
@@ -17518,8 +17481,8 @@ class Axios {
17518
17481
  return await this._request(configOrUrl, config);
17519
17482
  } catch (err) {
17520
17483
  if (err instanceof Error) {
17521
- let dummy;
17522
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
17484
+ let dummy = {};
17485
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
17523
17486
 
17524
17487
  // slice off the Error: ... line
17525
17488
  const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
@@ -17571,6 +17534,10 @@ class Axios {
17571
17534
  }, true);
17572
17535
  }
17573
17536
  }
17537
+ validator.assertOptions(config, {
17538
+ baseUrl: validators.spelling('baseURL'),
17539
+ withXsrfToken: validators.spelling('withXSRFToken')
17540
+ }, true);
17574
17541
 
17575
17542
  // Set config.method
17576
17543
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
@@ -22915,7 +22882,7 @@ function createContentfulApi({
22915
22882
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
22916
22883
  }
22917
22884
  return {
22918
- version: "11.2.4",
22885
+ version: "11.2.6",
22919
22886
  getSpace,
22920
22887
  getContentType,
22921
22888
  getContentTypes,
@@ -23034,7 +23001,7 @@ function createClient(params) {
23034
23001
  environment: 'master'
23035
23002
  };
23036
23003
  const config = Object.assign(Object.assign({}, defaultConfig), params);
23037
- const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.4"}`, config.application, config.integration);
23004
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.6"}`, config.application, config.integration);
23038
23005
  config.headers = Object.assign(Object.assign({}, config.headers), {
23039
23006
  'Content-Type': 'application/vnd.contentful.delivery.v1+json',
23040
23007
  'X-Contentful-User-Agent': userAgentHeader
@@ -37,7 +37,7 @@ function createClient(params) {
37
37
  environment: 'master',
38
38
  };
39
39
  const config = Object.assign(Object.assign({}, defaultConfig), params);
40
- const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.4"}`, config.application, config.integration);
40
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.2.6"}`, config.application, config.integration);
41
41
  config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': 'application/vnd.contentful.delivery.v1+json', 'X-Contentful-User-Agent': userAgentHeader });
42
42
  const http = createHttpClient(axios, config);
43
43
  if (!http.defaults.baseURL) {
@@ -300,7 +300,7 @@ function createContentfulApi({ http, getGlobalOptions }, options) {
300
300
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
301
301
  }
302
302
  return {
303
- version: "11.2.4",
303
+ version: "11.2.6",
304
304
  getSpace,
305
305
  getContentType,
306
306
  getContentTypes,