contentful 11.5.0 → 11.5.2

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.
@@ -7,11 +7,12 @@ var require$$3 = require('http');
7
7
  var require$$4 = require('https');
8
8
  var require$$0$2 = require('url');
9
9
  var require$$6 = require('fs');
10
+ var require$$1$2 = require('crypto');
10
11
  var require$$4$1 = require('assert');
11
12
  var require$$0$4 = require('tty');
12
13
  var require$$0$3 = require('os');
13
- var require$$7 = require('zlib');
14
- var require$$9 = require('events');
14
+ var require$$8 = require('zlib');
15
+ var require$$10 = require('events');
15
16
  var process$1 = require('process');
16
17
 
17
18
  function _OverloadYield(e, d) {
@@ -13878,21 +13879,23 @@ followRedirects$1.exports.wrap = wrap;
13878
13879
  var followRedirectsExports = followRedirects$1.exports;
13879
13880
 
13880
13881
  const FormData$1 = form_data;
13882
+ const crypto = require$$1$2;
13881
13883
  const url = require$$0$2;
13882
13884
  const proxyFromEnv = proxyFromEnv$1;
13883
13885
  const http = require$$3;
13884
13886
  const https = require$$4;
13885
13887
  const util = require$$1;
13886
13888
  const followRedirects = followRedirectsExports;
13887
- const zlib = require$$7;
13889
+ const zlib = require$$8;
13888
13890
  const stream = require$$0$1;
13889
- const events = require$$9;
13891
+ const events = require$$10;
13890
13892
  function _interopDefaultLegacy(e) {
13891
13893
  return e && typeof e === 'object' && 'default' in e ? e : {
13892
13894
  'default': e
13893
13895
  };
13894
13896
  }
13895
13897
  const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
13898
+ const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
13896
13899
  const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
13897
13900
  const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
13898
13901
  const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
@@ -14476,23 +14479,6 @@ const noop$1 = () => {};
14476
14479
  const toFiniteNumber = (value, defaultValue) => {
14477
14480
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
14478
14481
  };
14479
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
14480
- const DIGIT = '0123456789';
14481
- const ALPHABET = {
14482
- DIGIT,
14483
- ALPHA,
14484
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
14485
- };
14486
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
14487
- let str = '';
14488
- const {
14489
- length
14490
- } = alphabet;
14491
- while (size--) {
14492
- str += alphabet[Math.random() * length | 0];
14493
- }
14494
- return str;
14495
- };
14496
14482
 
14497
14483
  /**
14498
14484
  * If the thing is a FormData object, return true, otherwise return false.
@@ -14606,8 +14592,6 @@ const utils$1$1 = {
14606
14592
  findKey,
14607
14593
  global: _global,
14608
14594
  isContextDefined,
14609
- ALPHABET,
14610
- generateString,
14611
14595
  isSpecCompliantForm,
14612
14596
  toJSONObject,
14613
14597
  isAsyncFn,
@@ -15042,6 +15026,25 @@ const transitionalDefaults = {
15042
15026
  clarifyTimeoutError: false
15043
15027
  };
15044
15028
  const URLSearchParams = url__default["default"].URLSearchParams;
15029
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
15030
+ const DIGIT = '0123456789';
15031
+ const ALPHABET = {
15032
+ DIGIT,
15033
+ ALPHA,
15034
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
15035
+ };
15036
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
15037
+ let str = '';
15038
+ const {
15039
+ length
15040
+ } = alphabet;
15041
+ const randomValues = new Uint32Array(size);
15042
+ crypto__default["default"].randomFillSync(randomValues);
15043
+ for (let i = 0; i < size; i++) {
15044
+ str += alphabet[randomValues[i] % length];
15045
+ }
15046
+ return str;
15047
+ };
15045
15048
  const platform$1 = {
15046
15049
  isNode: true,
15047
15050
  classes: {
@@ -15049,6 +15052,8 @@ const platform$1 = {
15049
15052
  FormData: FormData__default["default"],
15050
15053
  Blob: typeof Blob !== 'undefined' && Blob || null
15051
15054
  },
15055
+ ALPHABET,
15056
+ generateString,
15052
15057
  protocols: ['http', 'https', 'file', 'data']
15053
15058
  };
15054
15059
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
@@ -15664,13 +15669,14 @@ function combineURLs(baseURL, relativeURL) {
15664
15669
  *
15665
15670
  * @returns {string} The combined full path
15666
15671
  */
15667
- function buildFullPath(baseURL, requestedURL) {
15668
- if (baseURL && !isAbsoluteURL(requestedURL)) {
15672
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
15673
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
15674
+ if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
15669
15675
  return combineURLs(baseURL, requestedURL);
15670
15676
  }
15671
15677
  return requestedURL;
15672
15678
  }
15673
- const VERSION = "1.7.9";
15679
+ const VERSION = "1.8.1";
15674
15680
  function parseProtocol(url) {
15675
15681
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
15676
15682
  return match && match[1] || '';
@@ -15848,7 +15854,7 @@ const readBlob = /*#__PURE__*/function () {
15848
15854
  };
15849
15855
  }();
15850
15856
  const readBlob$1 = readBlob;
15851
- const BOUNDARY_ALPHABET = utils$1$1.ALPHABET.ALPHA_DIGIT + '-_';
15857
+ const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
15852
15858
  const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default["default"].TextEncoder();
15853
15859
  const CRLF = '\r\n';
15854
15860
  const CRLF_BYTES = textEncoder.encode(CRLF);
@@ -15898,7 +15904,7 @@ const formDataToStream = (form, headersHandler, options) => {
15898
15904
  const {
15899
15905
  tag = 'form-data-boundary',
15900
15906
  size = 25,
15901
- boundary = tag + '-' + utils$1$1.generateString(size, BOUNDARY_ALPHABET)
15907
+ boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
15902
15908
  } = options || {};
15903
15909
  if (!utils$1$1.isFormData(form)) {
15904
15910
  throw TypeError('FormData instance required');
@@ -17554,6 +17560,13 @@ class Axios {
17554
17560
  }, true);
17555
17561
  }
17556
17562
  }
17563
+
17564
+ // Set config.allowAbsoluteUrls
17565
+ if (config.allowAbsoluteUrls !== undefined) ;else if (this.defaults.allowAbsoluteUrls !== undefined) {
17566
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
17567
+ } else {
17568
+ config.allowAbsoluteUrls = true;
17569
+ }
17557
17570
  validator.assertOptions(config, {
17558
17571
  baseUrl: validators.spelling('baseURL'),
17559
17572
  withXsrfToken: validators.spelling('withXSRFToken')
@@ -17624,7 +17637,7 @@ class Axios {
17624
17637
  }
17625
17638
  getUri(config) {
17626
17639
  config = mergeConfig(this.defaults, config);
17627
- const fullPath = buildFullPath(config.baseURL, config.url);
17640
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
17628
17641
  return buildURL(fullPath, config.params, config.paramsSerializer);
17629
17642
  }
17630
17643
  }
@@ -22962,7 +22975,7 @@ function createContentfulApi({
22962
22975
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
22963
22976
  }
22964
22977
  return {
22965
- version: "11.5.0",
22978
+ version: "11.5.2",
22966
22979
  getSpace,
22967
22980
  getContentType,
22968
22981
  getContentTypes,
@@ -23085,7 +23098,7 @@ function createClient(params) {
23085
23098
  environment: 'master'
23086
23099
  };
23087
23100
  const config = Object.assign(Object.assign({}, defaultConfig), params);
23088
- const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.5.0"}`, config.application, config.integration);
23101
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.5.2"}`, config.application, config.integration);
23089
23102
  config.headers = Object.assign(Object.assign({}, config.headers), {
23090
23103
  'Content-Type': 'application/vnd.contentful.delivery.v1+json',
23091
23104
  '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.5.0"}`, config.application, config.integration);
40
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"11.5.2"}`, 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) {
@@ -368,7 +368,7 @@ function createContentfulApi({ http, getGlobalOptions }, options) {
368
368
  http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
369
369
  }
370
370
  return {
371
- version: "11.5.0",
371
+ version: "11.5.2",
372
372
  getSpace,
373
373
  getContentType,
374
374
  getContentTypes,