contentful-management 7.45.2 → 7.45.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.
@@ -2683,15 +2683,16 @@ var rateLimitThrottle = (function (axiosInstance) {
2683
2683
  };
2684
2684
  });
2685
2685
 
2686
- var attempts = {};
2687
- var networkErrorAttempts = 0;
2688
-
2689
2686
  var delay = function delay(ms) {
2690
2687
  return new Promise(function (resolve) {
2691
2688
  setTimeout(resolve, ms);
2692
2689
  });
2693
2690
  };
2694
2691
 
2692
+ var defaultWait = function defaultWait(attempts) {
2693
+ return Math.pow(Math.SQRT2, attempts);
2694
+ };
2695
+
2695
2696
  function rateLimit(instance) {
2696
2697
  var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
2697
2698
  var _instance$defaults = instance.defaults,
@@ -2717,40 +2718,24 @@ function rateLimit(instance) {
2717
2718
 
2718
2719
  if (!config || !instance.defaults.retryOnError) {
2719
2720
  return Promise.reject(error);
2721
+ } // Retried already for max attempts
2722
+
2723
+
2724
+ var doneAttempts = config.attempts || 1;
2725
+
2726
+ if (doneAttempts > maxRetry) {
2727
+ error.attempts = config.attempts;
2728
+ return Promise.reject(error);
2720
2729
  }
2721
2730
 
2722
2731
  var retryErrorType = null;
2723
- var wait = 0; // Errors without response did not receive anything from the server
2732
+ var wait = defaultWait(doneAttempts); // Errors without response did not receive anything from the server
2724
2733
 
2725
2734
  if (!response) {
2726
2735
  retryErrorType = 'Connection';
2727
- networkErrorAttempts++;
2728
-
2729
- if (networkErrorAttempts > maxRetry) {
2730
- error.attempts = networkErrorAttempts;
2731
- return Promise.reject(error);
2732
- }
2733
-
2734
- wait = Math.pow(Math.SQRT2, networkErrorAttempts);
2735
- response = {};
2736
- } else {
2737
- networkErrorAttempts = 0;
2738
- }
2739
-
2740
- if (response.status >= 500 && response.status < 600) {
2736
+ } else if (response.status >= 500 && response.status < 600) {
2741
2737
  // 5** errors are server related
2742
2738
  retryErrorType = "Server ".concat(response.status);
2743
- var headers = response.headers || {};
2744
- var requestId = headers['x-contentful-request-id'] || null;
2745
- attempts[requestId] = attempts[requestId] || 0;
2746
- attempts[requestId]++; // we reject if there are too many errors with the same request id or request id is not defined
2747
-
2748
- if (attempts[requestId] > maxRetry || !requestId) {
2749
- error.attempts = attempts[requestId];
2750
- return Promise.reject(error);
2751
- }
2752
-
2753
- wait = Math.pow(Math.SQRT2, attempts[requestId]);
2754
2739
  } else if (response.status === 429) {
2755
2740
  // 429 errors are exceeded rate limit exceptions
2756
2741
  retryErrorType = 'Rate limit'; // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
@@ -2763,7 +2748,9 @@ function rateLimit(instance) {
2763
2748
  if (retryErrorType) {
2764
2749
  // convert to ms and add jitter
2765
2750
  wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
2766
- instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
2751
+ instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying...")); // increase attempts counter
2752
+
2753
+ config.attempts = doneAttempts + 1;
2767
2754
  /* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
2768
2755
  to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
2769
2756
  requests still use the original http/httpsAgent property */
@@ -4366,6 +4353,7 @@ var match = String.prototype.match;
4366
4353
  var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
4367
4354
  var gOPS = Object.getOwnPropertySymbols;
4368
4355
  var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
4356
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
4369
4357
  var isEnumerable = Object.prototype.propertyIsEnumerable;
4370
4358
 
4371
4359
  var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
@@ -4378,7 +4366,7 @@ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPr
4378
4366
 
4379
4367
  var inspectCustom = __webpack_require__(/*! ./util.inspect */ 1).custom;
4380
4368
  var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
4381
- var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol' ? Symbol.toStringTag : null;
4369
+ var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag !== 'undefined' ? Symbol.toStringTag : null;
4382
4370
 
4383
4371
  module.exports = function inspect_(obj, options, depth, seen) {
4384
4372
  var opts = options || {};
@@ -4395,8 +4383,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
4395
4383
  throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
4396
4384
  }
4397
4385
  var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
4398
- if (typeof customInspect !== 'boolean') {
4399
- throw new TypeError('option "customInspect", if provided, must be `true` or `false`');
4386
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
4387
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
4400
4388
  }
4401
4389
 
4402
4390
  if (
@@ -4468,8 +4456,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
4468
4456
  return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
4469
4457
  }
4470
4458
  if (isSymbol(obj)) {
4471
- var symString = symToString.call(obj);
4472
- return typeof obj === 'object' ? markBoxed(symString) : symString;
4459
+ var symString = hasShammedSymbols ? String(obj).replace(/^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
4460
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
4473
4461
  }
4474
4462
  if (isElement(obj)) {
4475
4463
  var s = '<' + String(obj.nodeName).toLowerCase();
@@ -4498,7 +4486,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
4498
4486
  if (typeof obj === 'object' && customInspect) {
4499
4487
  if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
4500
4488
  return obj[inspectSymbol]();
4501
- } else if (typeof obj.inspect === 'function') {
4489
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
4502
4490
  return obj.inspect();
4503
4491
  }
4504
4492
  }
@@ -4572,6 +4560,9 @@ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toString
4572
4560
 
4573
4561
  // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
4574
4562
  function isSymbol(obj) {
4563
+ if (hasShammedSymbols) {
4564
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
4565
+ }
4575
4566
  if (typeof obj === 'symbol') {
4576
4567
  return true;
4577
4568
  }
@@ -4779,17 +4770,28 @@ function arrObjKeys(obj, inspect) {
4779
4770
  xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
4780
4771
  }
4781
4772
  }
4773
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
4774
+ var symMap;
4775
+ if (hasShammedSymbols) {
4776
+ symMap = {};
4777
+ for (var k = 0; k < syms.length; k++) {
4778
+ symMap['$' + syms[k]] = syms[k];
4779
+ }
4780
+ }
4781
+
4782
4782
  for (var key in obj) { // eslint-disable-line no-restricted-syntax
4783
4783
  if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
4784
4784
  if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
4785
- if ((/[^\w$]/).test(key)) {
4785
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
4786
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
4787
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
4788
+ } else if ((/[^\w$]/).test(key)) {
4786
4789
  xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
4787
4790
  } else {
4788
4791
  xs.push(key + ': ' + inspect(obj[key], obj));
4789
4792
  }
4790
4793
  }
4791
4794
  if (typeof gOPS === 'function') {
4792
- var syms = gOPS(obj);
4793
4795
  for (var j = 0; j < syms.length; j++) {
4794
4796
  if (isEnumerable.call(obj, syms[j])) {
4795
4797
  xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
@@ -7215,9 +7217,10 @@ var references = function references(http, params) {
7215
7217
  var spaceId = params.spaceId,
7216
7218
  environmentId = params.environmentId,
7217
7219
  entryId = params.entryId,
7218
- _params$maxDepth = params.maxDepth,
7219
- maxDepth = _params$maxDepth === void 0 ? 2 : _params$maxDepth;
7220
- return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(maxDepth));
7220
+ maxDepth = params.maxDepth,
7221
+ include = params.include;
7222
+ var level = include || maxDepth || 2;
7223
+ return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(level));
7221
7224
  };
7222
7225
 
7223
7226
  /***/ }),
@@ -9159,6 +9162,19 @@ var RestAdapter = /*#__PURE__*/function () {
9159
9162
  return RestAdapter;
9160
9163
  }();
9161
9164
 
9165
+ /***/ }),
9166
+
9167
+ /***/ "./common-types.ts":
9168
+ /*!*************************!*\
9169
+ !*** ./common-types.ts ***!
9170
+ \*************************/
9171
+ /*! no exports provided */
9172
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
9173
+
9174
+ "use strict";
9175
+ __webpack_require__.r(__webpack_exports__);
9176
+
9177
+
9162
9178
  /***/ }),
9163
9179
 
9164
9180
  /***/ "./common-utils.ts":
@@ -9570,7 +9586,6 @@ var SidebarWidgetTypes = {
9570
9586
  VERSIONS: 'versions-widget',
9571
9587
  INFO_PANEL: 'info-panel',
9572
9588
  JOBS: 'jobs-widget',
9573
- TASKS: 'content-workflows-tasks-widget',
9574
9589
  COMMENTS_PANEL: 'comments-panel'
9575
9590
  };
9576
9591
  var Publication = {
@@ -9585,12 +9600,6 @@ var Releases = {
9585
9600
  name: 'Release',
9586
9601
  description: 'Built-in - View release, add to it, etc.'
9587
9602
  };
9588
- var Tasks = {
9589
- widgetId: SidebarWidgetTypes.TASKS,
9590
- widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
9591
- name: 'Tasks',
9592
- description: 'Built-in - Assign tasks to be completed before publishing. Currently only supported for master environment.'
9593
- };
9594
9603
  var ContentPreview = {
9595
9604
  widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
9596
9605
  widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
@@ -9621,7 +9630,7 @@ var Users = {
9621
9630
  name: 'Users',
9622
9631
  description: 'Built-in - Displays users on the same entry.'
9623
9632
  };
9624
- var SidebarEntryConfiguration = [Publication, Releases, Tasks, ContentPreview, Links, Translation, Versions, Users];
9633
+ var SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
9625
9634
  var SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
9626
9635
 
9627
9636
  /***/ }),
@@ -9688,7 +9697,8 @@ __webpack_require__.r(__webpack_exports__);
9688
9697
  /* harmony import */ var _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./adapters/REST/rest-adapter */ "./adapters/REST/rest-adapter.ts");
9689
9698
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RestAdapter", function() { return _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__["RestAdapter"]; });
9690
9699
 
9691
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9700
+ /* harmony import */ var _export_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./export-types */ "./export-types.ts");
9701
+ /* empty/unused harmony star reexport */function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9692
9702
 
9693
9703
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9694
9704
 
@@ -9710,11 +9720,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
9710
9720
 
9711
9721
 
9712
9722
 
9723
+
9713
9724
  function createClient(params) {
9714
9725
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9715
9726
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
9716
9727
  var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
9717
- "".concat(sdkMain, "/").concat("7.45.2"), params.application, params.integration, params.feature);
9728
+ "".concat(sdkMain, "/").concat("7.45.6"), params.application, params.integration, params.feature);
9718
9729
  var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
9719
9730
  // https://github.com/microsoft/TypeScript/issues/26591
9720
9731
  // @ts-expect-error
@@ -10954,7 +10965,7 @@ function createEntryApi(makeRequest) {
10954
10965
  spaceId: raw.sys.space.sys.id,
10955
10966
  environmentId: raw.sys.environment.sys.id,
10956
10967
  entryId: raw.sys.id,
10957
- maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
10968
+ maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
10958
10969
  }
10959
10970
  }).then(function (response) {
10960
10971
  return wrapEntryCollection(makeRequest, response);
@@ -11794,7 +11805,8 @@ function createEnvironmentApi(makeRequest) {
11794
11805
  /**
11795
11806
  * Get entry references
11796
11807
  * @param entryId - Entry ID
11797
- * @param {Object} options.maxDepth - Level of the entry descendants from 1 up to 10 maximum
11808
+ * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
11809
+ * @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include`
11798
11810
  * @returns Promise of Entry references
11799
11811
  * @example ```javascript
11800
11812
  * const contentful = require('contentful-management');
@@ -11806,10 +11818,10 @@ function createEnvironmentApi(makeRequest) {
11806
11818
  * // Get entry references
11807
11819
  * client.getSpace('<space_id>')
11808
11820
  * .then((space) => space.getEnvironment('<environment_id>'))
11809
- * .then((environment) => environment.getEntryReferences('<entry_id>', {maxDepth: number}))
11821
+ * .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
11810
11822
  * .then((entry) => console.log(entry.includes))
11811
11823
  * // or
11812
- * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({maxDepth: number}))
11824
+ * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
11813
11825
  * .catch(console.error)
11814
11826
  * ```
11815
11827
  */
@@ -11822,7 +11834,11 @@ function createEnvironmentApi(makeRequest) {
11822
11834
  spaceId: raw.sys.space.sys.id,
11823
11835
  environmentId: raw.sys.id,
11824
11836
  entryId: entryId,
11825
- maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
11837
+
11838
+ /**
11839
+ * @deprecated use `include` instead
11840
+ */
11841
+ maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
11826
11842
  }
11827
11843
  }).then(function (response) {
11828
11844
  return wrapEntryCollection(makeRequest, response);
@@ -15336,13 +15352,15 @@ function createSpaceApi(makeRequest) {
15336
15352
  * }
15337
15353
  * },
15338
15354
  * environment: {
15339
- * type: 'Link',
15340
- * linkType: 'Environment',
15341
- * id: '<environment_id>'
15355
+ * sys: {
15356
+ * type: 'Link',
15357
+ * linkType: 'Environment',
15358
+ * id: '<environment_id>'
15359
+ * }
15342
15360
  * },
15343
15361
  * action: 'publish',
15344
15362
  * scheduledFor: {
15345
- * dateTime: <ISO_date_string>,
15363
+ * datetime: <ISO_date_string>,
15346
15364
  * timezone: 'Europe/Berlin'
15347
15365
  * }
15348
15366
  * }))
@@ -15389,13 +15407,15 @@ function createSpaceApi(makeRequest) {
15389
15407
  * }
15390
15408
  * },
15391
15409
  * environment: {
15392
- * type: 'Link',
15393
- * linkType: 'Environment',
15394
- * id: '<environment_id>'
15410
+ * sys: {
15411
+ * type: 'Link',
15412
+ * linkType: 'Environment',
15413
+ * id: '<environment_id>'
15414
+ * }
15395
15415
  * },
15396
15416
  * action: 'publish',
15397
15417
  * scheduledFor: {
15398
- * dateTime: <ISO_date_string>,
15418
+ * datetime: <ISO_date_string>,
15399
15419
  * timezone: 'Europe/Berlin'
15400
15420
  * }
15401
15421
  * })
@@ -17865,13 +17885,15 @@ function getInstanceMethods(makeRequest) {
17865
17885
  * }
17866
17886
  * },
17867
17887
  * environment: {
17868
- * type: 'Link',
17869
- * linkType: 'Environment',
17870
- * id: '<environment_id>'
17888
+ * sys: {
17889
+ * type: 'Link',
17890
+ * linkType: 'Environment',
17891
+ * id: '<environment_id>'
17892
+ * }
17871
17893
  * },
17872
17894
  * action: 'publish',
17873
17895
  * scheduledFor: {
17874
- * dateTime: <ISO_date_string>,
17896
+ * datetime: <ISO_date_string>,
17875
17897
  * timezone: 'Europe/Berlin'
17876
17898
  * }
17877
17899
  * })
@@ -17928,13 +17950,15 @@ function getInstanceMethods(makeRequest) {
17928
17950
  * }
17929
17951
  * },
17930
17952
  * environment: {
17931
- * type: 'Link',
17932
- * linkType: 'Environment',
17933
- * id: '<environment_id>'
17953
+ * sys: {
17954
+ * type: 'Link',
17955
+ * linkType: 'Environment',
17956
+ * id: '<environment_id>'
17957
+ * }
17934
17958
  * },
17935
17959
  * action: 'publish',
17936
17960
  * scheduledFor: {
17937
- * dateTime: <ISO_date_string>,
17961
+ * datetime: <ISO_date_string>,
17938
17962
  * timezone: 'Europe/Berlin'
17939
17963
  * }
17940
17964
  * })
@@ -18865,6 +18889,21 @@ function wrapWebhook(makeRequest, data) {
18865
18889
 
18866
18890
  var wrapWebhookCollection = Object(_common_utils__WEBPACK_IMPORTED_MODULE_2__["wrapCollection"])(wrapWebhook);
18867
18891
 
18892
+ /***/ }),
18893
+
18894
+ /***/ "./export-types.ts":
18895
+ /*!*************************!*\
18896
+ !*** ./export-types.ts ***!
18897
+ \*************************/
18898
+ /*! no exports provided */
18899
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
18900
+
18901
+ "use strict";
18902
+ __webpack_require__.r(__webpack_exports__);
18903
+ /* harmony import */ var _common_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common-types */ "./common-types.ts");
18904
+ /* empty/unused harmony star reexport */
18905
+
18906
+
18868
18907
  /***/ }),
18869
18908
 
18870
18909
  /***/ "./methods/action.ts":