contentful-management 11.27.4 → 11.27.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.
@@ -17168,6 +17168,31 @@ function _arrayLikeToArray(r, a) {
17168
17168
  function _arrayWithHoles(r) {
17169
17169
  if (Array.isArray(r)) return r;
17170
17170
  }
17171
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
17172
+ try {
17173
+ var i = n[a](c),
17174
+ u = i.value;
17175
+ } catch (n) {
17176
+ return void e(n);
17177
+ }
17178
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
17179
+ }
17180
+ function _asyncToGenerator(n) {
17181
+ return function () {
17182
+ var t = this,
17183
+ e = arguments;
17184
+ return new Promise(function (r, o) {
17185
+ var a = n.apply(t, e);
17186
+ function _next(n) {
17187
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
17188
+ }
17189
+ function _throw(n) {
17190
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
17191
+ }
17192
+ _next(void 0);
17193
+ });
17194
+ };
17195
+ }
17171
17196
  function _createForOfIteratorHelper(r, e) {
17172
17197
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
17173
17198
  if (!t) {
@@ -17287,6 +17312,307 @@ function _objectSpread2(e) {
17287
17312
  }
17288
17313
  return e;
17289
17314
  }
17315
+ function _regeneratorRuntime() {
17316
+ _regeneratorRuntime = function () {
17317
+ return e;
17318
+ };
17319
+ var t,
17320
+ e = {},
17321
+ r = Object.prototype,
17322
+ n = r.hasOwnProperty,
17323
+ o = Object.defineProperty || function (t, e, r) {
17324
+ t[e] = r.value;
17325
+ },
17326
+ i = "function" == typeof Symbol ? Symbol : {},
17327
+ a = i.iterator || "@@iterator",
17328
+ c = i.asyncIterator || "@@asyncIterator",
17329
+ u = i.toStringTag || "@@toStringTag";
17330
+ function define(t, e, r) {
17331
+ return Object.defineProperty(t, e, {
17332
+ value: r,
17333
+ enumerable: !0,
17334
+ configurable: !0,
17335
+ writable: !0
17336
+ }), t[e];
17337
+ }
17338
+ try {
17339
+ define({}, "");
17340
+ } catch (t) {
17341
+ define = function (t, e, r) {
17342
+ return t[e] = r;
17343
+ };
17344
+ }
17345
+ function wrap(t, e, r, n) {
17346
+ var i = e && e.prototype instanceof Generator ? e : Generator,
17347
+ a = Object.create(i.prototype),
17348
+ c = new Context(n || []);
17349
+ return o(a, "_invoke", {
17350
+ value: makeInvokeMethod(t, r, c)
17351
+ }), a;
17352
+ }
17353
+ function tryCatch(t, e, r) {
17354
+ try {
17355
+ return {
17356
+ type: "normal",
17357
+ arg: t.call(e, r)
17358
+ };
17359
+ } catch (t) {
17360
+ return {
17361
+ type: "throw",
17362
+ arg: t
17363
+ };
17364
+ }
17365
+ }
17366
+ e.wrap = wrap;
17367
+ var h = "suspendedStart",
17368
+ l = "suspendedYield",
17369
+ f = "executing",
17370
+ s = "completed",
17371
+ y = {};
17372
+ function Generator() {}
17373
+ function GeneratorFunction() {}
17374
+ function GeneratorFunctionPrototype() {}
17375
+ var p = {};
17376
+ define(p, a, function () {
17377
+ return this;
17378
+ });
17379
+ var d = Object.getPrototypeOf,
17380
+ v = d && d(d(values([])));
17381
+ v && v !== r && n.call(v, a) && (p = v);
17382
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
17383
+ function defineIteratorMethods(t) {
17384
+ ["next", "throw", "return"].forEach(function (e) {
17385
+ define(t, e, function (t) {
17386
+ return this._invoke(e, t);
17387
+ });
17388
+ });
17389
+ }
17390
+ function AsyncIterator(t, e) {
17391
+ function invoke(r, o, i, a) {
17392
+ var c = tryCatch(t[r], t, o);
17393
+ if ("throw" !== c.type) {
17394
+ var u = c.arg,
17395
+ h = u.value;
17396
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
17397
+ invoke("next", t, i, a);
17398
+ }, function (t) {
17399
+ invoke("throw", t, i, a);
17400
+ }) : e.resolve(h).then(function (t) {
17401
+ u.value = t, i(u);
17402
+ }, function (t) {
17403
+ return invoke("throw", t, i, a);
17404
+ });
17405
+ }
17406
+ a(c.arg);
17407
+ }
17408
+ var r;
17409
+ o(this, "_invoke", {
17410
+ value: function (t, n) {
17411
+ function callInvokeWithMethodAndArg() {
17412
+ return new e(function (e, r) {
17413
+ invoke(t, n, e, r);
17414
+ });
17415
+ }
17416
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
17417
+ }
17418
+ });
17419
+ }
17420
+ function makeInvokeMethod(e, r, n) {
17421
+ var o = h;
17422
+ return function (i, a) {
17423
+ if (o === f) throw Error("Generator is already running");
17424
+ if (o === s) {
17425
+ if ("throw" === i) throw a;
17426
+ return {
17427
+ value: t,
17428
+ done: !0
17429
+ };
17430
+ }
17431
+ for (n.method = i, n.arg = a;;) {
17432
+ var c = n.delegate;
17433
+ if (c) {
17434
+ var u = maybeInvokeDelegate(c, n);
17435
+ if (u) {
17436
+ if (u === y) continue;
17437
+ return u;
17438
+ }
17439
+ }
17440
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
17441
+ if (o === h) throw o = s, n.arg;
17442
+ n.dispatchException(n.arg);
17443
+ } else "return" === n.method && n.abrupt("return", n.arg);
17444
+ o = f;
17445
+ var p = tryCatch(e, r, n);
17446
+ if ("normal" === p.type) {
17447
+ if (o = n.done ? s : l, p.arg === y) continue;
17448
+ return {
17449
+ value: p.arg,
17450
+ done: n.done
17451
+ };
17452
+ }
17453
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
17454
+ }
17455
+ };
17456
+ }
17457
+ function maybeInvokeDelegate(e, r) {
17458
+ var n = r.method,
17459
+ o = e.iterator[n];
17460
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
17461
+ var i = tryCatch(o, e.iterator, r.arg);
17462
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
17463
+ var a = i.arg;
17464
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
17465
+ }
17466
+ function pushTryEntry(t) {
17467
+ var e = {
17468
+ tryLoc: t[0]
17469
+ };
17470
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
17471
+ }
17472
+ function resetTryEntry(t) {
17473
+ var e = t.completion || {};
17474
+ e.type = "normal", delete e.arg, t.completion = e;
17475
+ }
17476
+ function Context(t) {
17477
+ this.tryEntries = [{
17478
+ tryLoc: "root"
17479
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
17480
+ }
17481
+ function values(e) {
17482
+ if (e || "" === e) {
17483
+ var r = e[a];
17484
+ if (r) return r.call(e);
17485
+ if ("function" == typeof e.next) return e;
17486
+ if (!isNaN(e.length)) {
17487
+ var o = -1,
17488
+ i = function next() {
17489
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
17490
+ return next.value = t, next.done = !0, next;
17491
+ };
17492
+ return i.next = i;
17493
+ }
17494
+ }
17495
+ throw new TypeError(typeof e + " is not iterable");
17496
+ }
17497
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
17498
+ value: GeneratorFunctionPrototype,
17499
+ configurable: !0
17500
+ }), o(GeneratorFunctionPrototype, "constructor", {
17501
+ value: GeneratorFunction,
17502
+ configurable: !0
17503
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
17504
+ var e = "function" == typeof t && t.constructor;
17505
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
17506
+ }, e.mark = function (t) {
17507
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
17508
+ }, e.awrap = function (t) {
17509
+ return {
17510
+ __await: t
17511
+ };
17512
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
17513
+ return this;
17514
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
17515
+ void 0 === i && (i = Promise);
17516
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
17517
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
17518
+ return t.done ? t.value : a.next();
17519
+ });
17520
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
17521
+ return this;
17522
+ }), define(g, "toString", function () {
17523
+ return "[object Generator]";
17524
+ }), e.keys = function (t) {
17525
+ var e = Object(t),
17526
+ r = [];
17527
+ for (var n in e) r.push(n);
17528
+ return r.reverse(), function next() {
17529
+ for (; r.length;) {
17530
+ var t = r.pop();
17531
+ if (t in e) return next.value = t, next.done = !1, next;
17532
+ }
17533
+ return next.done = !0, next;
17534
+ };
17535
+ }, e.values = values, Context.prototype = {
17536
+ constructor: Context,
17537
+ reset: function (e) {
17538
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
17539
+ },
17540
+ stop: function () {
17541
+ this.done = !0;
17542
+ var t = this.tryEntries[0].completion;
17543
+ if ("throw" === t.type) throw t.arg;
17544
+ return this.rval;
17545
+ },
17546
+ dispatchException: function (e) {
17547
+ if (this.done) throw e;
17548
+ var r = this;
17549
+ function handle(n, o) {
17550
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
17551
+ }
17552
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
17553
+ var i = this.tryEntries[o],
17554
+ a = i.completion;
17555
+ if ("root" === i.tryLoc) return handle("end");
17556
+ if (i.tryLoc <= this.prev) {
17557
+ var c = n.call(i, "catchLoc"),
17558
+ u = n.call(i, "finallyLoc");
17559
+ if (c && u) {
17560
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
17561
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
17562
+ } else if (c) {
17563
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
17564
+ } else {
17565
+ if (!u) throw Error("try statement without catch or finally");
17566
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
17567
+ }
17568
+ }
17569
+ }
17570
+ },
17571
+ abrupt: function (t, e) {
17572
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
17573
+ var o = this.tryEntries[r];
17574
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
17575
+ var i = o;
17576
+ break;
17577
+ }
17578
+ }
17579
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
17580
+ var a = i ? i.completion : {};
17581
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
17582
+ },
17583
+ complete: function (t, e) {
17584
+ if ("throw" === t.type) throw t.arg;
17585
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
17586
+ },
17587
+ finish: function (t) {
17588
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
17589
+ var r = this.tryEntries[e];
17590
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
17591
+ }
17592
+ },
17593
+ catch: function (t) {
17594
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
17595
+ var r = this.tryEntries[e];
17596
+ if (r.tryLoc === t) {
17597
+ var n = r.completion;
17598
+ if ("throw" === n.type) {
17599
+ var o = n.arg;
17600
+ resetTryEntry(r);
17601
+ }
17602
+ return o;
17603
+ }
17604
+ }
17605
+ throw Error("illegal catch attempt");
17606
+ },
17607
+ delegateYield: function (e, r, n) {
17608
+ return this.delegate = {
17609
+ iterator: values(e),
17610
+ resultName: r,
17611
+ nextLoc: n
17612
+ }, "next" === this.method && (this.arg = t), y;
17613
+ }
17614
+ }, e;
17615
+ }
17290
17616
  function _setPrototypeOf(t, e) {
17291
17617
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
17292
17618
  return t.__proto__ = e, t;
@@ -17431,57 +17757,85 @@ function rateLimit(instance) {
17431
17757
  // we don't need to do anything here
17432
17758
  responseLogger(response);
17433
17759
  return response;
17434
- }, function (error) {
17435
- var response = error.response;
17436
- var config = error.config;
17437
- responseLogger(error);
17438
- // Do not retry if it is disabled or no request config exists (not an axios error)
17439
- if (!config || !instance.defaults.retryOnError) {
17440
- return Promise.reject(error);
17441
- }
17442
-
17443
- // Retried already for max attempts
17444
- var doneAttempts = config.attempts || 1;
17445
- if (doneAttempts > maxRetry) {
17446
- error.attempts = config.attempts;
17447
- return Promise.reject(error);
17448
- }
17449
- var retryErrorType = null;
17450
- var wait = defaultWait(doneAttempts);
17451
-
17452
- // Errors without response did not receive anything from the server
17453
- if (!response) {
17454
- retryErrorType = 'Connection';
17455
- } else if (response.status >= 500 && response.status < 600) {
17456
- // 5** errors are server related
17457
- retryErrorType = "Server ".concat(response.status);
17458
- } else if (response.status === 429) {
17459
- // 429 errors are exceeded rate limit exceptions
17460
- retryErrorType = 'Rate limit';
17461
- // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
17462
- if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
17463
- wait = response.headers['x-contentful-ratelimit-reset'];
17464
- }
17465
- }
17466
- if (retryErrorType) {
17467
- // convert to ms and add jitter
17468
- wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
17469
- instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
17470
-
17471
- // increase attempts counter
17472
- config.attempts = doneAttempts + 1;
17473
-
17474
- /* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
17475
- to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
17476
- requests still use the original http/httpsAgent property */
17477
- delete config.httpAgent;
17478
- delete config.httpsAgent;
17479
- return delay(wait).then(function () {
17480
- return instance(config);
17481
- });
17482
- }
17483
- return Promise.reject(error);
17484
- });
17760
+ }, /*#__PURE__*/function () {
17761
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(error) {
17762
+ var response, config, doneAttempts, retryErrorType, wait;
17763
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17764
+ while (1) switch (_context.prev = _context.next) {
17765
+ case 0:
17766
+ response = error.response;
17767
+ config = error.config;
17768
+ responseLogger(error);
17769
+ // Do not retry if it is disabled or no request config exists (not an axios error)
17770
+ if (!(!config || !instance.defaults.retryOnError)) {
17771
+ _context.next = 5;
17772
+ break;
17773
+ }
17774
+ return _context.abrupt("return", Promise.reject(error));
17775
+ case 5:
17776
+ // Retried already for max attempts
17777
+ doneAttempts = config.attempts || 1;
17778
+ if (!(doneAttempts > maxRetry)) {
17779
+ _context.next = 9;
17780
+ break;
17781
+ }
17782
+ error.attempts = config.attempts;
17783
+ return _context.abrupt("return", Promise.reject(error));
17784
+ case 9:
17785
+ retryErrorType = null;
17786
+ wait = defaultWait(doneAttempts); // Errors without response did not receive anything from the server
17787
+ if (!response) {
17788
+ retryErrorType = 'Connection';
17789
+ } else if (response.status >= 500 && response.status < 600) {
17790
+ // 5** errors are server related
17791
+ retryErrorType = "Server ".concat(response.status);
17792
+ } else if (response.status === 429) {
17793
+ // 429 errors are exceeded rate limit exceptions
17794
+ retryErrorType = 'Rate limit';
17795
+ // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
17796
+ if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
17797
+ wait = response.headers['x-contentful-ratelimit-reset'];
17798
+ }
17799
+ }
17800
+ if (!retryErrorType) {
17801
+ _context.next = 20;
17802
+ break;
17803
+ }
17804
+ // convert to ms and add jitter
17805
+ wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
17806
+ instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
17807
+
17808
+ // increase attempts counter
17809
+ config.attempts = doneAttempts + 1;
17810
+
17811
+ /* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
17812
+ to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
17813
+ requests still use the original http/httpsAgent property */
17814
+ delete config.httpAgent;
17815
+ delete config.httpsAgent;
17816
+
17817
+ /**
17818
+ * Hack to mitigate (likely) bug introduced in axios v1.7.0 where `url`,
17819
+ * when using the default `xhr` adapter, is a fully qualified URL (instead of a path),
17820
+ * which somehow causes the request params to be repeatedly appended
17821
+ * to the final request URL upon each retry.
17822
+ */
17823
+ config.url = config.url.split('?')[0];
17824
+ return _context.abrupt("return", delay(wait).then(function () {
17825
+ return instance(config);
17826
+ }));
17827
+ case 20:
17828
+ return _context.abrupt("return", Promise.reject(error));
17829
+ case 21:
17830
+ case "end":
17831
+ return _context.stop();
17832
+ }
17833
+ }, _callee);
17834
+ }));
17835
+ return function (_x) {
17836
+ return _ref.apply(this, arguments);
17837
+ };
17838
+ }());
17485
17839
  }
17486
17840
 
17487
17841
  var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
@@ -25462,7 +25816,7 @@ function createClient(params) {
25462
25816
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25463
25817
  var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
25464
25818
  var userAgent = (0,contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__.getUserAgentHeader)( // @ts-expect-error
25465
- "".concat(sdkMain, "/").concat("11.27.4"), params.application, params.integration, params.feature);
25819
+ "".concat(sdkMain, "/").concat("11.27.6"), params.application, params.integration, params.feature);
25466
25820
  var adapter = (0,_create_adapter__WEBPACK_IMPORTED_MODULE_1__.createAdapter)(_objectSpread(_objectSpread({}, params), {}, {
25467
25821
  userAgent: userAgent
25468
25822
  }));