contentful-management 12.0.0-new-beta.7 → 12.0.0-new-beta.8

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.
@@ -407,220 +407,8 @@ var contentfulManagement = (function (exports) {
407
407
  });
408
408
  }
409
409
 
410
- function getDefaultExportFromCjs (x) {
411
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
412
- }
413
-
414
- function getDefaultExportFromNamespaceIfNotNamed (n) {
415
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
416
- }
417
-
418
- var browser = {exports: {}};
419
-
420
- var hasRequiredBrowser;
421
-
422
- function requireBrowser () {
423
- if (hasRequiredBrowser) return browser.exports;
424
- hasRequiredBrowser = 1;
425
- // shim for using process in browser
426
- var process = browser.exports = {};
427
-
428
- // cached from whatever global is present so that test runners that stub it
429
- // don't break things. But we need to wrap it in a try catch in case it is
430
- // wrapped in strict mode code which doesn't define any globals. It's inside a
431
- // function because try/catches deoptimize in certain engines.
432
-
433
- var cachedSetTimeout;
434
- var cachedClearTimeout;
435
-
436
- function defaultSetTimout() {
437
- throw new Error('setTimeout has not been defined');
438
- }
439
- function defaultClearTimeout () {
440
- throw new Error('clearTimeout has not been defined');
441
- }
442
- (function () {
443
- try {
444
- if (typeof setTimeout === 'function') {
445
- cachedSetTimeout = setTimeout;
446
- } else {
447
- cachedSetTimeout = defaultSetTimout;
448
- }
449
- } catch (e) {
450
- cachedSetTimeout = defaultSetTimout;
451
- }
452
- try {
453
- if (typeof clearTimeout === 'function') {
454
- cachedClearTimeout = clearTimeout;
455
- } else {
456
- cachedClearTimeout = defaultClearTimeout;
457
- }
458
- } catch (e) {
459
- cachedClearTimeout = defaultClearTimeout;
460
- }
461
- } ());
462
- function runTimeout(fun) {
463
- if (cachedSetTimeout === setTimeout) {
464
- //normal enviroments in sane situations
465
- return setTimeout(fun, 0);
466
- }
467
- // if setTimeout wasn't available but was latter defined
468
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
469
- cachedSetTimeout = setTimeout;
470
- return setTimeout(fun, 0);
471
- }
472
- try {
473
- // when when somebody has screwed with setTimeout but no I.E. maddness
474
- return cachedSetTimeout(fun, 0);
475
- } catch(e){
476
- try {
477
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
478
- return cachedSetTimeout.call(null, fun, 0);
479
- } catch(e){
480
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
481
- return cachedSetTimeout.call(this, fun, 0);
482
- }
483
- }
484
-
485
-
486
- }
487
- function runClearTimeout(marker) {
488
- if (cachedClearTimeout === clearTimeout) {
489
- //normal enviroments in sane situations
490
- return clearTimeout(marker);
491
- }
492
- // if clearTimeout wasn't available but was latter defined
493
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
494
- cachedClearTimeout = clearTimeout;
495
- return clearTimeout(marker);
496
- }
497
- try {
498
- // when when somebody has screwed with setTimeout but no I.E. maddness
499
- return cachedClearTimeout(marker);
500
- } catch (e){
501
- try {
502
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
503
- return cachedClearTimeout.call(null, marker);
504
- } catch (e){
505
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
506
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
507
- return cachedClearTimeout.call(this, marker);
508
- }
509
- }
510
-
511
-
512
-
513
- }
514
- var queue = [];
515
- var draining = false;
516
- var currentQueue;
517
- var queueIndex = -1;
518
-
519
- function cleanUpNextTick() {
520
- if (!draining || !currentQueue) {
521
- return;
522
- }
523
- draining = false;
524
- if (currentQueue.length) {
525
- queue = currentQueue.concat(queue);
526
- } else {
527
- queueIndex = -1;
528
- }
529
- if (queue.length) {
530
- drainQueue();
531
- }
532
- }
533
-
534
- function drainQueue() {
535
- if (draining) {
536
- return;
537
- }
538
- var timeout = runTimeout(cleanUpNextTick);
539
- draining = true;
540
-
541
- var len = queue.length;
542
- while(len) {
543
- currentQueue = queue;
544
- queue = [];
545
- while (++queueIndex < len) {
546
- if (currentQueue) {
547
- currentQueue[queueIndex].run();
548
- }
549
- }
550
- queueIndex = -1;
551
- len = queue.length;
552
- }
553
- currentQueue = null;
554
- draining = false;
555
- runClearTimeout(timeout);
556
- }
557
-
558
- process.nextTick = function (fun) {
559
- var args = new Array(arguments.length - 1);
560
- if (arguments.length > 1) {
561
- for (var i = 1; i < arguments.length; i++) {
562
- args[i - 1] = arguments[i];
563
- }
564
- }
565
- queue.push(new Item(fun, args));
566
- if (queue.length === 1 && !draining) {
567
- runTimeout(drainQueue);
568
- }
569
- };
570
-
571
- // v8 likes predictible objects
572
- function Item(fun, array) {
573
- this.fun = fun;
574
- this.array = array;
575
- }
576
- Item.prototype.run = function () {
577
- this.fun.apply(null, this.array);
578
- };
579
- process.title = 'browser';
580
- process.browser = true;
581
- process.env = {};
582
- process.argv = [];
583
- process.version = ''; // empty string to avoid regexp issues
584
- process.versions = {};
585
-
586
- function noop() {}
587
-
588
- process.on = noop;
589
- process.addListener = noop;
590
- process.once = noop;
591
- process.off = noop;
592
- process.removeListener = noop;
593
- process.removeAllListeners = noop;
594
- process.emit = noop;
595
- process.prependListener = noop;
596
- process.prependOnceListener = noop;
597
-
598
- process.listeners = function (name) { return [] };
599
-
600
- process.binding = function (name) {
601
- throw new Error('process.binding is not supported');
602
- };
603
-
604
- process.cwd = function () { return '/' };
605
- process.chdir = function (dir) {
606
- throw new Error('process.chdir is not supported');
607
- };
608
- process.umask = function() { return 0; };
609
- return browser.exports;
610
- }
611
-
612
- var browserExports = requireBrowser();
613
- var process$1 = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
614
-
615
410
  function isNode() {
616
- /**
617
- * Polyfills of 'process' might set process.browser === true
618
- *
619
- * See:
620
- * https://github.com/webpack/node-libs-browser/blob/master/mock/process.js#L8
621
- * https://github.com/defunctzombie/node-process/blob/master/browser.js#L156
622
- **/
623
- return typeof process$1 !== 'undefined' && !process$1.browser;
411
+ return Boolean(typeof process !== 'undefined' && process.versions?.node);
624
412
  }
625
413
  function isReactNative() {
626
414
  return (typeof window !== 'undefined' &&
@@ -629,7 +417,7 @@ var contentfulManagement = (function (exports) {
629
417
  window.navigator.product === 'ReactNative');
630
418
  }
631
419
  function getNodeVersion() {
632
- return process$1.versions && process$1.versions.node ? `v${process$1.versions.node}` : process$1.version;
420
+ return process.versions && process.versions.node ? `v${process.versions.node}` : process.version;
633
421
  }
634
422
  function getWindow() {
635
423
  return window;
@@ -706,6 +494,14 @@ var contentfulManagement = (function (exports) {
706
494
  });
707
495
  }
708
496
 
497
+ function getDefaultExportFromCjs (x) {
498
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
499
+ }
500
+
501
+ function getDefaultExportFromNamespaceIfNotNamed (n) {
502
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
503
+ }
504
+
709
505
  /** Detect free variable `global` from Node.js. */
710
506
 
711
507
  var _freeGlobal;
@@ -995,90 +791,113 @@ var contentfulManagement = (function (exports) {
995
791
  var isString$1 = /*@__PURE__*/getDefaultExportFromCjs(isStringExports);
996
792
 
997
793
  class AbortError extends Error {
998
- constructor() {
999
- super('Throttled function aborted');
1000
- this.name = 'AbortError';
1001
- }
794
+ name = 'AbortError';
795
+ constructor() {
796
+ super('Throttled function aborted');
797
+ }
1002
798
  }
1003
-
1004
- function pThrottle({limit, interval, strict, onDelay}) {
1005
- if (!Number.isFinite(limit)) {
1006
- throw new TypeError('Expected `limit` to be a finite number');
1007
- }
1008
-
1009
- if (!Number.isFinite(interval)) {
1010
- throw new TypeError('Expected `interval` to be a finite number');
1011
- }
1012
-
1013
- const queue = new Map();
1014
-
1015
- let currentTick = 0;
1016
- let activeCount = 0;
1017
-
1018
- function windowedDelay() {
1019
- const now = Date.now();
1020
-
1021
- if ((now - currentTick) > interval) {
1022
- activeCount = 1;
1023
- currentTick = now;
1024
- return 0;
1025
- }
1026
-
1027
- if (activeCount < limit) {
1028
- activeCount++;
1029
- } else {
1030
- currentTick += interval;
1031
- activeCount = 1;
1032
- }
1033
-
1034
- return currentTick - now;
1035
- }
1036
-
1037
- const getDelay = windowedDelay;
1038
-
1039
- return function_ => {
1040
- const throttled = function (...arguments_) {
1041
- if (!throttled.isEnabled) {
1042
- return (async () => function_.apply(this, arguments_))();
1043
- }
1044
-
1045
- let timeoutId;
1046
- return new Promise((resolve, reject) => {
1047
- const execute = () => {
1048
- resolve(function_.apply(this, arguments_));
1049
- queue.delete(timeoutId);
1050
- };
1051
-
1052
- const delay = getDelay();
1053
- if (delay > 0) {
1054
- timeoutId = setTimeout(execute, delay);
1055
- queue.set(timeoutId, reject);
1056
- onDelay?.(...arguments_);
1057
- } else {
1058
- execute();
1059
- }
1060
- });
1061
- };
1062
-
1063
- throttled.abort = () => {
1064
- for (const timeout of queue.keys()) {
1065
- clearTimeout(timeout);
1066
- queue.get(timeout)(new AbortError());
1067
- }
1068
-
1069
- queue.clear();
1070
- };
1071
-
1072
- throttled.isEnabled = true;
1073
-
1074
- Object.defineProperty(throttled, 'queueSize', {
1075
- get() {
1076
- return queue.size;
1077
- },
1078
- });
1079
-
1080
- return throttled;
1081
- };
799
+ /**
800
+ * Throttle promise-returning/async/normal functions.
801
+ *
802
+ * It rate-limits function calls without discarding them, making it ideal for external API interactions where avoiding call loss is crucial.
803
+ *
804
+ * @returns A throttle function.
805
+ *
806
+ * Both the `limit` and `interval` options must be specified.
807
+ *
808
+ * @example
809
+ * ```
810
+ * import pThrottle from './PThrottle';
811
+ *
812
+ * const now = Date.now();
813
+ *
814
+ * const throttle = pThrottle({
815
+ * limit: 2,
816
+ * interval: 1000
817
+ * });
818
+ *
819
+ * const throttled = throttle(async index => {
820
+ * const secDiff = ((Date.now() - now) / 1000).toFixed();
821
+ * return `${index}: ${secDiff}s`;
822
+ * });
823
+ *
824
+ * for (let index = 1; index <= 6; index++) {
825
+ * (async () => {
826
+ * console.log(await throttled(index));
827
+ * })();
828
+ * }
829
+ * //=> 1: 0s
830
+ * //=> 2: 0s
831
+ * //=> 3: 1s
832
+ * //=> 4: 1s
833
+ * //=> 5: 2s
834
+ * //=> 6: 2s
835
+ * ```
836
+ */
837
+ function pThrottle({ limit, interval, strict, onDelay }) {
838
+ if (!Number.isFinite(limit)) {
839
+ throw new TypeError('Expected `limit` to be a finite number');
840
+ }
841
+ if (!Number.isFinite(interval)) {
842
+ throw new TypeError('Expected `interval` to be a finite number');
843
+ }
844
+ const queue = new Map();
845
+ let currentTick = 0;
846
+ let activeCount = 0;
847
+ function windowedDelay() {
848
+ const now = Date.now();
849
+ if (now - currentTick > interval) {
850
+ activeCount = 1;
851
+ currentTick = now;
852
+ return 0;
853
+ }
854
+ if (activeCount < limit) {
855
+ activeCount++;
856
+ }
857
+ else {
858
+ currentTick += interval;
859
+ activeCount = 1;
860
+ }
861
+ return currentTick - now;
862
+ }
863
+ const getDelay = windowedDelay;
864
+ return function (function_) {
865
+ const throttled = function (...arguments_) {
866
+ if (!throttled.isEnabled) {
867
+ return (async () => function_.apply(this, arguments_))();
868
+ }
869
+ let timeoutId;
870
+ return new Promise((resolve, reject) => {
871
+ const execute = () => {
872
+ resolve(function_.apply(this, arguments_));
873
+ queue.delete(timeoutId);
874
+ };
875
+ const delay = getDelay();
876
+ if (delay > 0) {
877
+ timeoutId = setTimeout(execute, delay);
878
+ queue.set(timeoutId, reject);
879
+ onDelay?.();
880
+ }
881
+ else {
882
+ execute();
883
+ }
884
+ });
885
+ };
886
+ throttled.abort = () => {
887
+ for (const timeout of queue.keys()) {
888
+ clearTimeout(timeout);
889
+ queue.get(timeout)(new AbortError());
890
+ }
891
+ queue.clear();
892
+ };
893
+ throttled.isEnabled = true;
894
+ Object.defineProperty(throttled, 'queueSize', {
895
+ get() {
896
+ return queue.size;
897
+ },
898
+ });
899
+ return throttled;
900
+ };
1082
901
  }
1083
902
 
1084
903
  const PERCENTAGE_REGEX = /(?<value>\d+)(%)/;
@@ -1155,6 +974,203 @@ var contentfulManagement = (function (exports) {
1155
974
  return type;
1156
975
  }
1157
976
 
977
+ var browser = {exports: {}};
978
+
979
+ var hasRequiredBrowser;
980
+
981
+ function requireBrowser () {
982
+ if (hasRequiredBrowser) return browser.exports;
983
+ hasRequiredBrowser = 1;
984
+ // shim for using process in browser
985
+ var process = browser.exports = {};
986
+
987
+ // cached from whatever global is present so that test runners that stub it
988
+ // don't break things. But we need to wrap it in a try catch in case it is
989
+ // wrapped in strict mode code which doesn't define any globals. It's inside a
990
+ // function because try/catches deoptimize in certain engines.
991
+
992
+ var cachedSetTimeout;
993
+ var cachedClearTimeout;
994
+
995
+ function defaultSetTimout() {
996
+ throw new Error('setTimeout has not been defined');
997
+ }
998
+ function defaultClearTimeout () {
999
+ throw new Error('clearTimeout has not been defined');
1000
+ }
1001
+ (function () {
1002
+ try {
1003
+ if (typeof setTimeout === 'function') {
1004
+ cachedSetTimeout = setTimeout;
1005
+ } else {
1006
+ cachedSetTimeout = defaultSetTimout;
1007
+ }
1008
+ } catch (e) {
1009
+ cachedSetTimeout = defaultSetTimout;
1010
+ }
1011
+ try {
1012
+ if (typeof clearTimeout === 'function') {
1013
+ cachedClearTimeout = clearTimeout;
1014
+ } else {
1015
+ cachedClearTimeout = defaultClearTimeout;
1016
+ }
1017
+ } catch (e) {
1018
+ cachedClearTimeout = defaultClearTimeout;
1019
+ }
1020
+ } ());
1021
+ function runTimeout(fun) {
1022
+ if (cachedSetTimeout === setTimeout) {
1023
+ //normal enviroments in sane situations
1024
+ return setTimeout(fun, 0);
1025
+ }
1026
+ // if setTimeout wasn't available but was latter defined
1027
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1028
+ cachedSetTimeout = setTimeout;
1029
+ return setTimeout(fun, 0);
1030
+ }
1031
+ try {
1032
+ // when when somebody has screwed with setTimeout but no I.E. maddness
1033
+ return cachedSetTimeout(fun, 0);
1034
+ } catch(e){
1035
+ try {
1036
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1037
+ return cachedSetTimeout.call(null, fun, 0);
1038
+ } catch(e){
1039
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
1040
+ return cachedSetTimeout.call(this, fun, 0);
1041
+ }
1042
+ }
1043
+
1044
+
1045
+ }
1046
+ function runClearTimeout(marker) {
1047
+ if (cachedClearTimeout === clearTimeout) {
1048
+ //normal enviroments in sane situations
1049
+ return clearTimeout(marker);
1050
+ }
1051
+ // if clearTimeout wasn't available but was latter defined
1052
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1053
+ cachedClearTimeout = clearTimeout;
1054
+ return clearTimeout(marker);
1055
+ }
1056
+ try {
1057
+ // when when somebody has screwed with setTimeout but no I.E. maddness
1058
+ return cachedClearTimeout(marker);
1059
+ } catch (e){
1060
+ try {
1061
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1062
+ return cachedClearTimeout.call(null, marker);
1063
+ } catch (e){
1064
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
1065
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1066
+ return cachedClearTimeout.call(this, marker);
1067
+ }
1068
+ }
1069
+
1070
+
1071
+
1072
+ }
1073
+ var queue = [];
1074
+ var draining = false;
1075
+ var currentQueue;
1076
+ var queueIndex = -1;
1077
+
1078
+ function cleanUpNextTick() {
1079
+ if (!draining || !currentQueue) {
1080
+ return;
1081
+ }
1082
+ draining = false;
1083
+ if (currentQueue.length) {
1084
+ queue = currentQueue.concat(queue);
1085
+ } else {
1086
+ queueIndex = -1;
1087
+ }
1088
+ if (queue.length) {
1089
+ drainQueue();
1090
+ }
1091
+ }
1092
+
1093
+ function drainQueue() {
1094
+ if (draining) {
1095
+ return;
1096
+ }
1097
+ var timeout = runTimeout(cleanUpNextTick);
1098
+ draining = true;
1099
+
1100
+ var len = queue.length;
1101
+ while(len) {
1102
+ currentQueue = queue;
1103
+ queue = [];
1104
+ while (++queueIndex < len) {
1105
+ if (currentQueue) {
1106
+ currentQueue[queueIndex].run();
1107
+ }
1108
+ }
1109
+ queueIndex = -1;
1110
+ len = queue.length;
1111
+ }
1112
+ currentQueue = null;
1113
+ draining = false;
1114
+ runClearTimeout(timeout);
1115
+ }
1116
+
1117
+ process.nextTick = function (fun) {
1118
+ var args = new Array(arguments.length - 1);
1119
+ if (arguments.length > 1) {
1120
+ for (var i = 1; i < arguments.length; i++) {
1121
+ args[i - 1] = arguments[i];
1122
+ }
1123
+ }
1124
+ queue.push(new Item(fun, args));
1125
+ if (queue.length === 1 && !draining) {
1126
+ runTimeout(drainQueue);
1127
+ }
1128
+ };
1129
+
1130
+ // v8 likes predictible objects
1131
+ function Item(fun, array) {
1132
+ this.fun = fun;
1133
+ this.array = array;
1134
+ }
1135
+ Item.prototype.run = function () {
1136
+ this.fun.apply(null, this.array);
1137
+ };
1138
+ process.title = 'browser';
1139
+ process.browser = true;
1140
+ process.env = {};
1141
+ process.argv = [];
1142
+ process.version = ''; // empty string to avoid regexp issues
1143
+ process.versions = {};
1144
+
1145
+ function noop() {}
1146
+
1147
+ process.on = noop;
1148
+ process.addListener = noop;
1149
+ process.once = noop;
1150
+ process.off = noop;
1151
+ process.removeListener = noop;
1152
+ process.removeAllListeners = noop;
1153
+ process.emit = noop;
1154
+ process.prependListener = noop;
1155
+ process.prependOnceListener = noop;
1156
+
1157
+ process.listeners = function (name) { return [] };
1158
+
1159
+ process.binding = function (name) {
1160
+ throw new Error('process.binding is not supported');
1161
+ };
1162
+
1163
+ process.cwd = function () { return '/' };
1164
+ process.chdir = function (dir) {
1165
+ throw new Error('process.chdir is not supported');
1166
+ };
1167
+ process.umask = function() { return 0; };
1168
+ return browser.exports;
1169
+ }
1170
+
1171
+ var browserExports = requireBrowser();
1172
+ var process$1 = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
1173
+
1158
1174
  var inherits;
1159
1175
  if (typeof Object.create === 'function'){
1160
1176
  inherits = function inherits(ctor, superCtor) {
@@ -5063,8 +5079,11 @@ var contentfulManagement = (function (exports) {
5063
5079
  return null;
5064
5080
  }
5065
5081
  function getNodeOS() {
5066
- const platform = process$1.platform || 'linux';
5067
- const version = process$1.version || '0.0.0';
5082
+ if (!isNode()) {
5083
+ return null;
5084
+ }
5085
+ const platform = process.platform || 'linux';
5086
+ const version = process.version || '0.0.0';
5068
5087
  const platformMap = {
5069
5088
  android: 'Android',
5070
5089
  aix: 'Linux',