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 */
@@ -7137,6 +7124,7 @@ var match = String.prototype.match;
7137
7124
  var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
7138
7125
  var gOPS = Object.getOwnPropertySymbols;
7139
7126
  var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
7127
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
7140
7128
  var isEnumerable = Object.prototype.propertyIsEnumerable;
7141
7129
 
7142
7130
  var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
@@ -7149,7 +7137,7 @@ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPr
7149
7137
 
7150
7138
  var inspectCustom = __webpack_require__(/*! ./util.inspect */ 1).custom;
7151
7139
  var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
7152
- var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol' ? Symbol.toStringTag : null;
7140
+ var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag !== 'undefined' ? Symbol.toStringTag : null;
7153
7141
 
7154
7142
  module.exports = function inspect_(obj, options, depth, seen) {
7155
7143
  var opts = options || {};
@@ -7166,8 +7154,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
7166
7154
  throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
7167
7155
  }
7168
7156
  var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
7169
- if (typeof customInspect !== 'boolean') {
7170
- throw new TypeError('option "customInspect", if provided, must be `true` or `false`');
7157
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
7158
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
7171
7159
  }
7172
7160
 
7173
7161
  if (
@@ -7239,8 +7227,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
7239
7227
  return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
7240
7228
  }
7241
7229
  if (isSymbol(obj)) {
7242
- var symString = symToString.call(obj);
7243
- return typeof obj === 'object' ? markBoxed(symString) : symString;
7230
+ var symString = hasShammedSymbols ? String(obj).replace(/^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
7231
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
7244
7232
  }
7245
7233
  if (isElement(obj)) {
7246
7234
  var s = '<' + String(obj.nodeName).toLowerCase();
@@ -7269,7 +7257,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
7269
7257
  if (typeof obj === 'object' && customInspect) {
7270
7258
  if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
7271
7259
  return obj[inspectSymbol]();
7272
- } else if (typeof obj.inspect === 'function') {
7260
+ } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
7273
7261
  return obj.inspect();
7274
7262
  }
7275
7263
  }
@@ -7343,6 +7331,9 @@ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toString
7343
7331
 
7344
7332
  // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
7345
7333
  function isSymbol(obj) {
7334
+ if (hasShammedSymbols) {
7335
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
7336
+ }
7346
7337
  if (typeof obj === 'symbol') {
7347
7338
  return true;
7348
7339
  }
@@ -7550,17 +7541,28 @@ function arrObjKeys(obj, inspect) {
7550
7541
  xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
7551
7542
  }
7552
7543
  }
7544
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
7545
+ var symMap;
7546
+ if (hasShammedSymbols) {
7547
+ symMap = {};
7548
+ for (var k = 0; k < syms.length; k++) {
7549
+ symMap['$' + syms[k]] = syms[k];
7550
+ }
7551
+ }
7552
+
7553
7553
  for (var key in obj) { // eslint-disable-line no-restricted-syntax
7554
7554
  if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
7555
7555
  if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
7556
- if ((/[^\w$]/).test(key)) {
7556
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
7557
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
7558
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
7559
+ } else if ((/[^\w$]/).test(key)) {
7557
7560
  xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
7558
7561
  } else {
7559
7562
  xs.push(key + ': ' + inspect(obj[key], obj));
7560
7563
  }
7561
7564
  }
7562
7565
  if (typeof gOPS === 'function') {
7563
- var syms = gOPS(obj);
7564
7566
  for (var j = 0; j < syms.length; j++) {
7565
7567
  if (isEnumerable.call(obj, syms[j])) {
7566
7568
  xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
@@ -9986,9 +9988,10 @@ var references = function references(http, params) {
9986
9988
  var spaceId = params.spaceId,
9987
9989
  environmentId = params.environmentId,
9988
9990
  entryId = params.entryId,
9989
- _params$maxDepth = params.maxDepth,
9990
- maxDepth = _params$maxDepth === void 0 ? 2 : _params$maxDepth;
9991
- return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(maxDepth));
9991
+ maxDepth = params.maxDepth,
9992
+ include = params.include;
9993
+ var level = include || maxDepth || 2;
9994
+ return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(level));
9992
9995
  };
9993
9996
 
9994
9997
  /***/ }),
@@ -11930,6 +11933,19 @@ var RestAdapter = /*#__PURE__*/function () {
11930
11933
  return RestAdapter;
11931
11934
  }();
11932
11935
 
11936
+ /***/ }),
11937
+
11938
+ /***/ "./common-types.ts":
11939
+ /*!*************************!*\
11940
+ !*** ./common-types.ts ***!
11941
+ \*************************/
11942
+ /*! no exports provided */
11943
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
11944
+
11945
+ "use strict";
11946
+ __webpack_require__.r(__webpack_exports__);
11947
+
11948
+
11933
11949
  /***/ }),
11934
11950
 
11935
11951
  /***/ "./common-utils.ts":
@@ -12341,7 +12357,6 @@ var SidebarWidgetTypes = {
12341
12357
  VERSIONS: 'versions-widget',
12342
12358
  INFO_PANEL: 'info-panel',
12343
12359
  JOBS: 'jobs-widget',
12344
- TASKS: 'content-workflows-tasks-widget',
12345
12360
  COMMENTS_PANEL: 'comments-panel'
12346
12361
  };
12347
12362
  var Publication = {
@@ -12356,12 +12371,6 @@ var Releases = {
12356
12371
  name: 'Release',
12357
12372
  description: 'Built-in - View release, add to it, etc.'
12358
12373
  };
12359
- var Tasks = {
12360
- widgetId: SidebarWidgetTypes.TASKS,
12361
- widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
12362
- name: 'Tasks',
12363
- description: 'Built-in - Assign tasks to be completed before publishing. Currently only supported for master environment.'
12364
- };
12365
12374
  var ContentPreview = {
12366
12375
  widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
12367
12376
  widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
@@ -12392,7 +12401,7 @@ var Users = {
12392
12401
  name: 'Users',
12393
12402
  description: 'Built-in - Displays users on the same entry.'
12394
12403
  };
12395
- var SidebarEntryConfiguration = [Publication, Releases, Tasks, ContentPreview, Links, Translation, Versions, Users];
12404
+ var SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
12396
12405
  var SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
12397
12406
 
12398
12407
  /***/ }),
@@ -12459,7 +12468,8 @@ __webpack_require__.r(__webpack_exports__);
12459
12468
  /* harmony import */ var _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./adapters/REST/rest-adapter */ "./adapters/REST/rest-adapter.ts");
12460
12469
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RestAdapter", function() { return _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__["RestAdapter"]; });
12461
12470
 
12462
- 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; }
12471
+ /* harmony import */ var _export_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./export-types */ "./export-types.ts");
12472
+ /* 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; }
12463
12473
 
12464
12474
  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; }
12465
12475
 
@@ -12481,11 +12491,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
12481
12491
 
12482
12492
 
12483
12493
 
12494
+
12484
12495
  function createClient(params) {
12485
12496
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12486
12497
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
12487
12498
  var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
12488
- "".concat(sdkMain, "/").concat("7.45.2"), params.application, params.integration, params.feature);
12499
+ "".concat(sdkMain, "/").concat("7.45.6"), params.application, params.integration, params.feature);
12489
12500
  var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
12490
12501
  // https://github.com/microsoft/TypeScript/issues/26591
12491
12502
  // @ts-expect-error
@@ -13725,7 +13736,7 @@ function createEntryApi(makeRequest) {
13725
13736
  spaceId: raw.sys.space.sys.id,
13726
13737
  environmentId: raw.sys.environment.sys.id,
13727
13738
  entryId: raw.sys.id,
13728
- maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
13739
+ maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
13729
13740
  }
13730
13741
  }).then(function (response) {
13731
13742
  return wrapEntryCollection(makeRequest, response);
@@ -14565,7 +14576,8 @@ function createEnvironmentApi(makeRequest) {
14565
14576
  /**
14566
14577
  * Get entry references
14567
14578
  * @param entryId - Entry ID
14568
- * @param {Object} options.maxDepth - Level of the entry descendants from 1 up to 10 maximum
14579
+ * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
14580
+ * @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include`
14569
14581
  * @returns Promise of Entry references
14570
14582
  * @example ```javascript
14571
14583
  * const contentful = require('contentful-management');
@@ -14577,10 +14589,10 @@ function createEnvironmentApi(makeRequest) {
14577
14589
  * // Get entry references
14578
14590
  * client.getSpace('<space_id>')
14579
14591
  * .then((space) => space.getEnvironment('<environment_id>'))
14580
- * .then((environment) => environment.getEntryReferences('<entry_id>', {maxDepth: number}))
14592
+ * .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
14581
14593
  * .then((entry) => console.log(entry.includes))
14582
14594
  * // or
14583
- * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({maxDepth: number}))
14595
+ * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
14584
14596
  * .catch(console.error)
14585
14597
  * ```
14586
14598
  */
@@ -14593,7 +14605,11 @@ function createEnvironmentApi(makeRequest) {
14593
14605
  spaceId: raw.sys.space.sys.id,
14594
14606
  environmentId: raw.sys.id,
14595
14607
  entryId: entryId,
14596
- maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
14608
+
14609
+ /**
14610
+ * @deprecated use `include` instead
14611
+ */
14612
+ maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
14597
14613
  }
14598
14614
  }).then(function (response) {
14599
14615
  return wrapEntryCollection(makeRequest, response);
@@ -18107,13 +18123,15 @@ function createSpaceApi(makeRequest) {
18107
18123
  * }
18108
18124
  * },
18109
18125
  * environment: {
18110
- * type: 'Link',
18111
- * linkType: 'Environment',
18112
- * id: '<environment_id>'
18126
+ * sys: {
18127
+ * type: 'Link',
18128
+ * linkType: 'Environment',
18129
+ * id: '<environment_id>'
18130
+ * }
18113
18131
  * },
18114
18132
  * action: 'publish',
18115
18133
  * scheduledFor: {
18116
- * dateTime: <ISO_date_string>,
18134
+ * datetime: <ISO_date_string>,
18117
18135
  * timezone: 'Europe/Berlin'
18118
18136
  * }
18119
18137
  * }))
@@ -18160,13 +18178,15 @@ function createSpaceApi(makeRequest) {
18160
18178
  * }
18161
18179
  * },
18162
18180
  * environment: {
18163
- * type: 'Link',
18164
- * linkType: 'Environment',
18165
- * id: '<environment_id>'
18181
+ * sys: {
18182
+ * type: 'Link',
18183
+ * linkType: 'Environment',
18184
+ * id: '<environment_id>'
18185
+ * }
18166
18186
  * },
18167
18187
  * action: 'publish',
18168
18188
  * scheduledFor: {
18169
- * dateTime: <ISO_date_string>,
18189
+ * datetime: <ISO_date_string>,
18170
18190
  * timezone: 'Europe/Berlin'
18171
18191
  * }
18172
18192
  * })
@@ -20636,13 +20656,15 @@ function getInstanceMethods(makeRequest) {
20636
20656
  * }
20637
20657
  * },
20638
20658
  * environment: {
20639
- * type: 'Link',
20640
- * linkType: 'Environment',
20641
- * id: '<environment_id>'
20659
+ * sys: {
20660
+ * type: 'Link',
20661
+ * linkType: 'Environment',
20662
+ * id: '<environment_id>'
20663
+ * }
20642
20664
  * },
20643
20665
  * action: 'publish',
20644
20666
  * scheduledFor: {
20645
- * dateTime: <ISO_date_string>,
20667
+ * datetime: <ISO_date_string>,
20646
20668
  * timezone: 'Europe/Berlin'
20647
20669
  * }
20648
20670
  * })
@@ -20699,13 +20721,15 @@ function getInstanceMethods(makeRequest) {
20699
20721
  * }
20700
20722
  * },
20701
20723
  * environment: {
20702
- * type: 'Link',
20703
- * linkType: 'Environment',
20704
- * id: '<environment_id>'
20724
+ * sys: {
20725
+ * type: 'Link',
20726
+ * linkType: 'Environment',
20727
+ * id: '<environment_id>'
20728
+ * }
20705
20729
  * },
20706
20730
  * action: 'publish',
20707
20731
  * scheduledFor: {
20708
- * dateTime: <ISO_date_string>,
20732
+ * datetime: <ISO_date_string>,
20709
20733
  * timezone: 'Europe/Berlin'
20710
20734
  * }
20711
20735
  * })
@@ -21636,6 +21660,21 @@ function wrapWebhook(makeRequest, data) {
21636
21660
 
21637
21661
  var wrapWebhookCollection = Object(_common_utils__WEBPACK_IMPORTED_MODULE_2__["wrapCollection"])(wrapWebhook);
21638
21662
 
21663
+ /***/ }),
21664
+
21665
+ /***/ "./export-types.ts":
21666
+ /*!*************************!*\
21667
+ !*** ./export-types.ts ***!
21668
+ \*************************/
21669
+ /*! no exports provided */
21670
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
21671
+
21672
+ "use strict";
21673
+ __webpack_require__.r(__webpack_exports__);
21674
+ /* harmony import */ var _common_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common-types */ "./common-types.ts");
21675
+ /* empty/unused harmony star reexport */
21676
+
21677
+
21639
21678
  /***/ }),
21640
21679
 
21641
21680
  /***/ "./methods/action.ts":