contentful-management 11.67.0 → 11.67.1
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.
- package/dist/contentful-management.browser.js +307 -177
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +305 -178
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/package.json +3 -3
|
@@ -23508,16 +23508,18 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
23508
23508
|
} else {
|
|
23509
23509
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
23510
23510
|
|
|
23511
|
-
|
|
23512
|
-
|
|
23513
|
-
|
|
23514
|
-
|
|
23515
|
-
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
|
|
23511
|
+
if (key !== null) {
|
|
23512
|
+
val = utils.maybeMap(
|
|
23513
|
+
parseArrayValue(
|
|
23514
|
+
part.slice(pos + 1),
|
|
23515
|
+
options,
|
|
23516
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
23517
|
+
),
|
|
23518
|
+
function (encodedVal) {
|
|
23519
|
+
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
23520
|
+
}
|
|
23521
|
+
);
|
|
23522
|
+
}
|
|
23521
23523
|
}
|
|
23522
23524
|
|
|
23523
23525
|
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
|
@@ -23528,11 +23530,18 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
23528
23530
|
val = isArray(val) ? [val] : val;
|
|
23529
23531
|
}
|
|
23530
23532
|
|
|
23531
|
-
|
|
23532
|
-
|
|
23533
|
-
|
|
23534
|
-
|
|
23535
|
-
|
|
23533
|
+
if (key !== null) {
|
|
23534
|
+
var existing = has.call(obj, key);
|
|
23535
|
+
if (existing && options.duplicates === 'combine') {
|
|
23536
|
+
obj[key] = utils.combine(
|
|
23537
|
+
obj[key],
|
|
23538
|
+
val,
|
|
23539
|
+
options.arrayLimit,
|
|
23540
|
+
options.plainObjects
|
|
23541
|
+
);
|
|
23542
|
+
} else if (!existing || options.duplicates === 'last') {
|
|
23543
|
+
obj[key] = val;
|
|
23544
|
+
}
|
|
23536
23545
|
}
|
|
23537
23546
|
}
|
|
23538
23547
|
|
|
@@ -23553,9 +23562,19 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
23553
23562
|
var root = chain[i];
|
|
23554
23563
|
|
|
23555
23564
|
if (root === '[]' && options.parseArrays) {
|
|
23556
|
-
|
|
23557
|
-
|
|
23558
|
-
|
|
23565
|
+
if (utils.isOverflow(leaf)) {
|
|
23566
|
+
// leaf is already an overflow object, preserve it
|
|
23567
|
+
obj = leaf;
|
|
23568
|
+
} else {
|
|
23569
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
23570
|
+
? []
|
|
23571
|
+
: utils.combine(
|
|
23572
|
+
[],
|
|
23573
|
+
leaf,
|
|
23574
|
+
options.arrayLimit,
|
|
23575
|
+
options.plainObjects
|
|
23576
|
+
);
|
|
23577
|
+
}
|
|
23559
23578
|
} else {
|
|
23560
23579
|
obj = options.plainObjects ? { __proto__: null } : {};
|
|
23561
23580
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
@@ -23583,29 +23602,28 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
23583
23602
|
return leaf;
|
|
23584
23603
|
};
|
|
23585
23604
|
|
|
23586
|
-
var
|
|
23587
|
-
if (!givenKey) {
|
|
23588
|
-
return;
|
|
23589
|
-
}
|
|
23590
|
-
|
|
23591
|
-
// Transform dot notation to bracket notation
|
|
23605
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
23592
23606
|
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
23593
23607
|
|
|
23594
|
-
|
|
23608
|
+
if (options.depth <= 0) {
|
|
23609
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
23610
|
+
if (!options.allowPrototypes) {
|
|
23611
|
+
return;
|
|
23612
|
+
}
|
|
23613
|
+
}
|
|
23614
|
+
|
|
23615
|
+
return [key];
|
|
23616
|
+
}
|
|
23595
23617
|
|
|
23596
23618
|
var brackets = /(\[[^[\]]*])/;
|
|
23597
23619
|
var child = /(\[[^[\]]*])/g;
|
|
23598
23620
|
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
var segment = options.depth > 0 && brackets.exec(key);
|
|
23621
|
+
var segment = brackets.exec(key);
|
|
23602
23622
|
var parent = segment ? key.slice(0, segment.index) : key;
|
|
23603
23623
|
|
|
23604
|
-
// Stash the parent if it exists
|
|
23605
|
-
|
|
23606
23624
|
var keys = [];
|
|
23625
|
+
|
|
23607
23626
|
if (parent) {
|
|
23608
|
-
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
|
23609
23627
|
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
23610
23628
|
if (!options.allowPrototypes) {
|
|
23611
23629
|
return;
|
|
@@ -23615,28 +23633,42 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
|
|
|
23615
23633
|
keys.push(parent);
|
|
23616
23634
|
}
|
|
23617
23635
|
|
|
23618
|
-
// Loop through children appending to the array until we hit depth
|
|
23619
|
-
|
|
23620
23636
|
var i = 0;
|
|
23621
|
-
while (
|
|
23637
|
+
while ((segment = child.exec(key)) !== null && i < options.depth) {
|
|
23622
23638
|
i += 1;
|
|
23623
|
-
|
|
23639
|
+
|
|
23640
|
+
var segmentContent = segment[1].slice(1, -1);
|
|
23641
|
+
if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
|
|
23624
23642
|
if (!options.allowPrototypes) {
|
|
23625
23643
|
return;
|
|
23626
23644
|
}
|
|
23627
23645
|
}
|
|
23646
|
+
|
|
23628
23647
|
keys.push(segment[1]);
|
|
23629
23648
|
}
|
|
23630
23649
|
|
|
23631
|
-
// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
|
23632
|
-
|
|
23633
23650
|
if (segment) {
|
|
23634
23651
|
if (options.strictDepth === true) {
|
|
23635
23652
|
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
23636
23653
|
}
|
|
23654
|
+
|
|
23637
23655
|
keys.push('[' + key.slice(segment.index) + ']');
|
|
23638
23656
|
}
|
|
23639
23657
|
|
|
23658
|
+
return keys;
|
|
23659
|
+
};
|
|
23660
|
+
|
|
23661
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
23662
|
+
if (!givenKey) {
|
|
23663
|
+
return;
|
|
23664
|
+
}
|
|
23665
|
+
|
|
23666
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
23667
|
+
|
|
23668
|
+
if (!keys) {
|
|
23669
|
+
return;
|
|
23670
|
+
}
|
|
23671
|
+
|
|
23640
23672
|
return parseObject(keys, val, options, valuesParsed);
|
|
23641
23673
|
};
|
|
23642
23674
|
|
|
@@ -24107,10 +24139,32 @@ module.exports = function (object, opts) {
|
|
|
24107
24139
|
|
|
24108
24140
|
|
|
24109
24141
|
var formats = __webpack_require__(/*! ./formats */ "../node_modules/qs/lib/formats.js");
|
|
24142
|
+
var getSideChannel = __webpack_require__(/*! side-channel */ "../node_modules/side-channel/index.js");
|
|
24110
24143
|
|
|
24111
24144
|
var has = Object.prototype.hasOwnProperty;
|
|
24112
24145
|
var isArray = Array.isArray;
|
|
24113
24146
|
|
|
24147
|
+
// Track objects created from arrayLimit overflow using side-channel
|
|
24148
|
+
// Stores the current max numeric index for O(1) lookup
|
|
24149
|
+
var overflowChannel = getSideChannel();
|
|
24150
|
+
|
|
24151
|
+
var markOverflow = function markOverflow(obj, maxIndex) {
|
|
24152
|
+
overflowChannel.set(obj, maxIndex);
|
|
24153
|
+
return obj;
|
|
24154
|
+
};
|
|
24155
|
+
|
|
24156
|
+
var isOverflow = function isOverflow(obj) {
|
|
24157
|
+
return overflowChannel.has(obj);
|
|
24158
|
+
};
|
|
24159
|
+
|
|
24160
|
+
var getMaxIndex = function getMaxIndex(obj) {
|
|
24161
|
+
return overflowChannel.get(obj);
|
|
24162
|
+
};
|
|
24163
|
+
|
|
24164
|
+
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
|
24165
|
+
overflowChannel.set(obj, maxIndex);
|
|
24166
|
+
};
|
|
24167
|
+
|
|
24114
24168
|
var hexTable = (function () {
|
|
24115
24169
|
var array = [];
|
|
24116
24170
|
for (var i = 0; i < 256; ++i) {
|
|
@@ -24160,7 +24214,12 @@ var merge = function merge(target, source, options) {
|
|
|
24160
24214
|
if (isArray(target)) {
|
|
24161
24215
|
target.push(source);
|
|
24162
24216
|
} else if (target && typeof target === 'object') {
|
|
24163
|
-
if (
|
|
24217
|
+
if (isOverflow(target)) {
|
|
24218
|
+
// Add at next numeric index for overflow objects
|
|
24219
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
24220
|
+
target[newIndex] = source;
|
|
24221
|
+
setMaxIndex(target, newIndex);
|
|
24222
|
+
} else if (
|
|
24164
24223
|
(options && (options.plainObjects || options.allowPrototypes))
|
|
24165
24224
|
|| !has.call(Object.prototype, source)
|
|
24166
24225
|
) {
|
|
@@ -24174,6 +24233,18 @@ var merge = function merge(target, source, options) {
|
|
|
24174
24233
|
}
|
|
24175
24234
|
|
|
24176
24235
|
if (!target || typeof target !== 'object') {
|
|
24236
|
+
if (isOverflow(source)) {
|
|
24237
|
+
// Create new object with target at 0, source values shifted by 1
|
|
24238
|
+
var sourceKeys = Object.keys(source);
|
|
24239
|
+
var result = options && options.plainObjects
|
|
24240
|
+
? { __proto__: null, 0: target }
|
|
24241
|
+
: { 0: target };
|
|
24242
|
+
for (var m = 0; m < sourceKeys.length; m++) {
|
|
24243
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
24244
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
24245
|
+
}
|
|
24246
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
24247
|
+
}
|
|
24177
24248
|
return [target].concat(source);
|
|
24178
24249
|
}
|
|
24179
24250
|
|
|
@@ -24345,8 +24416,20 @@ var isBuffer = function isBuffer(obj) {
|
|
|
24345
24416
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
24346
24417
|
};
|
|
24347
24418
|
|
|
24348
|
-
var combine = function combine(a, b) {
|
|
24349
|
-
|
|
24419
|
+
var combine = function combine(a, b, arrayLimit, plainObjects) {
|
|
24420
|
+
// If 'a' is already an overflow object, add to it
|
|
24421
|
+
if (isOverflow(a)) {
|
|
24422
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
24423
|
+
a[newIndex] = b;
|
|
24424
|
+
setMaxIndex(a, newIndex);
|
|
24425
|
+
return a;
|
|
24426
|
+
}
|
|
24427
|
+
|
|
24428
|
+
var result = [].concat(a, b);
|
|
24429
|
+
if (result.length > arrayLimit) {
|
|
24430
|
+
return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
|
|
24431
|
+
}
|
|
24432
|
+
return result;
|
|
24350
24433
|
};
|
|
24351
24434
|
|
|
24352
24435
|
var maybeMap = function maybeMap(val, fn) {
|
|
@@ -24368,6 +24451,7 @@ module.exports = {
|
|
|
24368
24451
|
decode: decode,
|
|
24369
24452
|
encode: encode,
|
|
24370
24453
|
isBuffer: isBuffer,
|
|
24454
|
+
isOverflow: isOverflow,
|
|
24371
24455
|
isRegExp: isRegExp,
|
|
24372
24456
|
maybeMap: maybeMap,
|
|
24373
24457
|
merge: merge
|
|
@@ -29612,6 +29696,9 @@ function asyncToken(instance, getToken) {
|
|
|
29612
29696
|
}
|
|
29613
29697
|
|
|
29614
29698
|
|
|
29699
|
+
//# sourceMappingURL=async-token.js.map
|
|
29700
|
+
|
|
29701
|
+
|
|
29615
29702
|
/***/ }),
|
|
29616
29703
|
|
|
29617
29704
|
/***/ "../node_modules/contentful-sdk-core/dist/create-default-options.js":
|
|
@@ -29627,6 +29714,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29627
29714
|
/* harmony export */ });
|
|
29628
29715
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
29629
29716
|
|
|
29717
|
+
|
|
29630
29718
|
// Matches 'sub.host:port' or 'host:port' and extracts hostname and port
|
|
29631
29719
|
// Also enforces toplevel domain specified, no spaces and no protocol
|
|
29632
29720
|
const HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
@@ -29678,7 +29766,6 @@ function createDefaultOptions(options) {
|
|
|
29678
29766
|
if (config.host && HOST_REGEX.test(config.host)) {
|
|
29679
29767
|
const parsed = config.host.split(':');
|
|
29680
29768
|
if (parsed.length === 2) {
|
|
29681
|
-
;
|
|
29682
29769
|
[hostname, port] = parsed;
|
|
29683
29770
|
}
|
|
29684
29771
|
else {
|
|
@@ -29719,6 +29806,9 @@ function createDefaultOptions(options) {
|
|
|
29719
29806
|
}
|
|
29720
29807
|
|
|
29721
29808
|
|
|
29809
|
+
//# sourceMappingURL=create-default-options.js.map
|
|
29810
|
+
|
|
29811
|
+
|
|
29722
29812
|
/***/ }),
|
|
29723
29813
|
|
|
29724
29814
|
/***/ "../node_modules/contentful-sdk-core/dist/create-http-client.js":
|
|
@@ -29742,6 +29832,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29742
29832
|
|
|
29743
29833
|
|
|
29744
29834
|
|
|
29835
|
+
|
|
29745
29836
|
function copyHttpClientParams(options) {
|
|
29746
29837
|
const copiedOptions = (0,fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(options);
|
|
29747
29838
|
// httpAgent and httpsAgent cannot be copied because they can contain private fields
|
|
@@ -29797,6 +29888,9 @@ function createHttpClient(axios, options) {
|
|
|
29797
29888
|
}
|
|
29798
29889
|
|
|
29799
29890
|
|
|
29891
|
+
//# sourceMappingURL=create-http-client.js.map
|
|
29892
|
+
|
|
29893
|
+
|
|
29800
29894
|
/***/ }),
|
|
29801
29895
|
|
|
29802
29896
|
/***/ "../node_modules/contentful-sdk-core/dist/create-request-config.js":
|
|
@@ -29812,6 +29906,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29812
29906
|
/* harmony export */ });
|
|
29813
29907
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/esm/index.mjs");
|
|
29814
29908
|
|
|
29909
|
+
|
|
29815
29910
|
/**
|
|
29816
29911
|
* Creates request parameters configuration by parsing an existing query object
|
|
29817
29912
|
* @private
|
|
@@ -29826,6 +29921,9 @@ function createRequestConfig({ query }) {
|
|
|
29826
29921
|
}
|
|
29827
29922
|
|
|
29828
29923
|
|
|
29924
|
+
//# sourceMappingURL=create-request-config.js.map
|
|
29925
|
+
|
|
29926
|
+
|
|
29829
29927
|
/***/ }),
|
|
29830
29928
|
|
|
29831
29929
|
/***/ "../node_modules/contentful-sdk-core/dist/enforce-obj-path.js":
|
|
@@ -29855,6 +29953,9 @@ ${JSON.stringify(obj)}
|
|
|
29855
29953
|
}
|
|
29856
29954
|
|
|
29857
29955
|
|
|
29956
|
+
//# sourceMappingURL=enforce-obj-path.js.map
|
|
29957
|
+
|
|
29958
|
+
|
|
29858
29959
|
/***/ }),
|
|
29859
29960
|
|
|
29860
29961
|
/***/ "../node_modules/contentful-sdk-core/dist/error-handler.js":
|
|
@@ -29870,6 +29971,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29870
29971
|
/* harmony export */ });
|
|
29871
29972
|
/* harmony import */ var lodash_isPlainObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isPlainObject.js */ "../node_modules/lodash/isPlainObject.js");
|
|
29872
29973
|
|
|
29974
|
+
|
|
29873
29975
|
function obscureHeaders(config) {
|
|
29874
29976
|
// Management, Delivery and Preview API tokens
|
|
29875
29977
|
if (config?.headers?.['Authorization']) {
|
|
@@ -29937,6 +30039,9 @@ function errorHandler(errorResponse) {
|
|
|
29937
30039
|
}
|
|
29938
30040
|
|
|
29939
30041
|
|
|
30042
|
+
//# sourceMappingURL=error-handler.js.map
|
|
30043
|
+
|
|
30044
|
+
|
|
29940
30045
|
/***/ }),
|
|
29941
30046
|
|
|
29942
30047
|
/***/ "../node_modules/contentful-sdk-core/dist/freeze-sys.js":
|
|
@@ -29967,6 +30072,9 @@ function freezeSys(obj) {
|
|
|
29967
30072
|
}
|
|
29968
30073
|
|
|
29969
30074
|
|
|
30075
|
+
//# sourceMappingURL=freeze-sys.js.map
|
|
30076
|
+
|
|
30077
|
+
|
|
29970
30078
|
/***/ }),
|
|
29971
30079
|
|
|
29972
30080
|
/***/ "../node_modules/contentful-sdk-core/dist/get-user-agent.js":
|
|
@@ -29984,6 +30092,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29984
30092
|
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ "../node_modules/contentful-sdk-core/dist/utils.js");
|
|
29985
30093
|
|
|
29986
30094
|
|
|
30095
|
+
|
|
29987
30096
|
function getBrowserOS() {
|
|
29988
30097
|
const win = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.getWindow)();
|
|
29989
30098
|
if (!win) {
|
|
@@ -30067,6 +30176,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
30067
30176
|
}
|
|
30068
30177
|
|
|
30069
30178
|
|
|
30179
|
+
//# sourceMappingURL=get-user-agent.js.map
|
|
30180
|
+
|
|
30181
|
+
|
|
30070
30182
|
/***/ }),
|
|
30071
30183
|
|
|
30072
30184
|
/***/ "../node_modules/contentful-sdk-core/dist/index.js":
|
|
@@ -30103,6 +30215,135 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30103
30215
|
|
|
30104
30216
|
|
|
30105
30217
|
|
|
30218
|
+
//# sourceMappingURL=index.js.map
|
|
30219
|
+
|
|
30220
|
+
|
|
30221
|
+
/***/ }),
|
|
30222
|
+
|
|
30223
|
+
/***/ "../node_modules/contentful-sdk-core/dist/pThrottle.js":
|
|
30224
|
+
/*!*************************************************************!*\
|
|
30225
|
+
!*** ../node_modules/contentful-sdk-core/dist/pThrottle.js ***!
|
|
30226
|
+
\*************************************************************/
|
|
30227
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
30228
|
+
|
|
30229
|
+
"use strict";
|
|
30230
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30231
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30232
|
+
/* harmony export */ AbortError: function() { return /* binding */ AbortError; },
|
|
30233
|
+
/* harmony export */ "default": function() { return /* binding */ pThrottle; }
|
|
30234
|
+
/* harmony export */ });
|
|
30235
|
+
class AbortError extends Error {
|
|
30236
|
+
name = 'AbortError';
|
|
30237
|
+
constructor() {
|
|
30238
|
+
super('Throttled function aborted');
|
|
30239
|
+
}
|
|
30240
|
+
}
|
|
30241
|
+
/**
|
|
30242
|
+
* Throttle promise-returning/async/normal functions.
|
|
30243
|
+
*
|
|
30244
|
+
* It rate-limits function calls without discarding them, making it ideal for external API interactions where avoiding call loss is crucial.
|
|
30245
|
+
*
|
|
30246
|
+
* @returns A throttle function.
|
|
30247
|
+
*
|
|
30248
|
+
* Both the `limit` and `interval` options must be specified.
|
|
30249
|
+
*
|
|
30250
|
+
* @example
|
|
30251
|
+
* ```
|
|
30252
|
+
* import pThrottle from './PThrottle';
|
|
30253
|
+
*
|
|
30254
|
+
* const now = Date.now();
|
|
30255
|
+
*
|
|
30256
|
+
* const throttle = pThrottle({
|
|
30257
|
+
* limit: 2,
|
|
30258
|
+
* interval: 1000
|
|
30259
|
+
* });
|
|
30260
|
+
*
|
|
30261
|
+
* const throttled = throttle(async index => {
|
|
30262
|
+
* const secDiff = ((Date.now() - now) / 1000).toFixed();
|
|
30263
|
+
* return `${index}: ${secDiff}s`;
|
|
30264
|
+
* });
|
|
30265
|
+
*
|
|
30266
|
+
* for (let index = 1; index <= 6; index++) {
|
|
30267
|
+
* (async () => {
|
|
30268
|
+
* console.log(await throttled(index));
|
|
30269
|
+
* })();
|
|
30270
|
+
* }
|
|
30271
|
+
* //=> 1: 0s
|
|
30272
|
+
* //=> 2: 0s
|
|
30273
|
+
* //=> 3: 1s
|
|
30274
|
+
* //=> 4: 1s
|
|
30275
|
+
* //=> 5: 2s
|
|
30276
|
+
* //=> 6: 2s
|
|
30277
|
+
* ```
|
|
30278
|
+
*/
|
|
30279
|
+
function pThrottle({ limit, interval, strict, onDelay }) {
|
|
30280
|
+
if (!Number.isFinite(limit)) {
|
|
30281
|
+
throw new TypeError('Expected `limit` to be a finite number');
|
|
30282
|
+
}
|
|
30283
|
+
if (!Number.isFinite(interval)) {
|
|
30284
|
+
throw new TypeError('Expected `interval` to be a finite number');
|
|
30285
|
+
}
|
|
30286
|
+
const queue = new Map();
|
|
30287
|
+
let currentTick = 0;
|
|
30288
|
+
let activeCount = 0;
|
|
30289
|
+
function windowedDelay() {
|
|
30290
|
+
const now = Date.now();
|
|
30291
|
+
if (now - currentTick > interval) {
|
|
30292
|
+
activeCount = 1;
|
|
30293
|
+
currentTick = now;
|
|
30294
|
+
return 0;
|
|
30295
|
+
}
|
|
30296
|
+
if (activeCount < limit) {
|
|
30297
|
+
activeCount++;
|
|
30298
|
+
}
|
|
30299
|
+
else {
|
|
30300
|
+
currentTick += interval;
|
|
30301
|
+
activeCount = 1;
|
|
30302
|
+
}
|
|
30303
|
+
return currentTick - now;
|
|
30304
|
+
}
|
|
30305
|
+
const getDelay = windowedDelay;
|
|
30306
|
+
return function (function_) {
|
|
30307
|
+
const throttled = function (...arguments_) {
|
|
30308
|
+
if (!throttled.isEnabled) {
|
|
30309
|
+
return (async () => function_.apply(this, arguments_))();
|
|
30310
|
+
}
|
|
30311
|
+
let timeoutId;
|
|
30312
|
+
return new Promise((resolve, reject) => {
|
|
30313
|
+
const execute = () => {
|
|
30314
|
+
resolve(function_.apply(this, arguments_));
|
|
30315
|
+
queue.delete(timeoutId);
|
|
30316
|
+
};
|
|
30317
|
+
const delay = getDelay();
|
|
30318
|
+
if (delay > 0) {
|
|
30319
|
+
timeoutId = setTimeout(execute, delay);
|
|
30320
|
+
queue.set(timeoutId, reject);
|
|
30321
|
+
onDelay?.();
|
|
30322
|
+
}
|
|
30323
|
+
else {
|
|
30324
|
+
execute();
|
|
30325
|
+
}
|
|
30326
|
+
});
|
|
30327
|
+
};
|
|
30328
|
+
throttled.abort = () => {
|
|
30329
|
+
for (const timeout of queue.keys()) {
|
|
30330
|
+
clearTimeout(timeout);
|
|
30331
|
+
queue.get(timeout)(new AbortError());
|
|
30332
|
+
}
|
|
30333
|
+
queue.clear();
|
|
30334
|
+
};
|
|
30335
|
+
throttled.isEnabled = true;
|
|
30336
|
+
Object.defineProperty(throttled, 'queueSize', {
|
|
30337
|
+
get() {
|
|
30338
|
+
return queue.size;
|
|
30339
|
+
},
|
|
30340
|
+
});
|
|
30341
|
+
return throttled;
|
|
30342
|
+
};
|
|
30343
|
+
}
|
|
30344
|
+
|
|
30345
|
+
|
|
30346
|
+
//# sourceMappingURL=pThrottle.js.map
|
|
30106
30347
|
|
|
30107
30348
|
|
|
30108
30349
|
/***/ }),
|
|
@@ -30115,9 +30356,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30115
30356
|
|
|
30116
30357
|
"use strict";
|
|
30117
30358
|
__webpack_require__.r(__webpack_exports__);
|
|
30359
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30360
|
+
/* harmony export */ "default": function() { return /* binding */ rateLimitThrottle; }
|
|
30361
|
+
/* harmony export */ });
|
|
30118
30362
|
/* harmony import */ var lodash_isString_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isString.js */ "../node_modules/lodash/isString.js");
|
|
30119
|
-
/* harmony import */ var
|
|
30120
|
-
/* harmony import */ var
|
|
30363
|
+
/* harmony import */ var _pThrottle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pThrottle.js */ "../node_modules/contentful-sdk-core/dist/pThrottle.js");
|
|
30364
|
+
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "../node_modules/contentful-sdk-core/dist/utils.js");
|
|
30365
|
+
|
|
30121
30366
|
|
|
30122
30367
|
|
|
30123
30368
|
|
|
@@ -30135,14 +30380,14 @@ function calculateLimit(type, max = 7) {
|
|
|
30135
30380
|
}
|
|
30136
30381
|
function createThrottle(limit, logger) {
|
|
30137
30382
|
logger('info', `Throttle request to ${limit}/s`);
|
|
30138
|
-
return (0,
|
|
30383
|
+
return (0,_pThrottle_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
30139
30384
|
limit,
|
|
30140
30385
|
interval: 1000,
|
|
30141
30386
|
strict: false,
|
|
30142
30387
|
});
|
|
30143
30388
|
}
|
|
30144
|
-
|
|
30145
|
-
const { logHandler =
|
|
30389
|
+
var rateLimitThrottle = (axiosInstance, type = 'auto') => {
|
|
30390
|
+
const { logHandler = _utils_js__WEBPACK_IMPORTED_MODULE_2__.noop } = axiosInstance.defaults;
|
|
30146
30391
|
let limit = lodash_isString_js__WEBPACK_IMPORTED_MODULE_0__(type) ? calculateLimit(type) : calculateLimit('auto', type);
|
|
30147
30392
|
let throttle = createThrottle(limit, logHandler);
|
|
30148
30393
|
let isCalculated = false;
|
|
@@ -30181,7 +30426,10 @@ function createThrottle(limit, logger) {
|
|
|
30181
30426
|
axiosInstance.interceptors.request.eject(requestInterceptorId);
|
|
30182
30427
|
axiosInstance.interceptors.response.eject(responseInterceptorId);
|
|
30183
30428
|
};
|
|
30184
|
-
}
|
|
30429
|
+
};
|
|
30430
|
+
|
|
30431
|
+
|
|
30432
|
+
//# sourceMappingURL=rate-limit-throttle.js.map
|
|
30185
30433
|
|
|
30186
30434
|
|
|
30187
30435
|
/***/ }),
|
|
@@ -30199,6 +30447,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30199
30447
|
/* harmony export */ });
|
|
30200
30448
|
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ "../node_modules/contentful-sdk-core/dist/utils.js");
|
|
30201
30449
|
|
|
30450
|
+
|
|
30202
30451
|
const delay = (ms) => new Promise((resolve) => {
|
|
30203
30452
|
setTimeout(resolve, ms);
|
|
30204
30453
|
});
|
|
@@ -30268,6 +30517,9 @@ function rateLimit(instance, maxRetry = 5) {
|
|
|
30268
30517
|
}
|
|
30269
30518
|
|
|
30270
30519
|
|
|
30520
|
+
//# sourceMappingURL=rate-limit.js.map
|
|
30521
|
+
|
|
30522
|
+
|
|
30271
30523
|
/***/ }),
|
|
30272
30524
|
|
|
30273
30525
|
/***/ "../node_modules/contentful-sdk-core/dist/to-plain-object.js":
|
|
@@ -30283,6 +30535,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30283
30535
|
/* harmony export */ });
|
|
30284
30536
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/esm/index.mjs");
|
|
30285
30537
|
|
|
30538
|
+
|
|
30286
30539
|
/**
|
|
30287
30540
|
* Mixes in a method to return just a plain object with no additional methods
|
|
30288
30541
|
* @private
|
|
@@ -30303,6 +30556,9 @@ function toPlainObject(data) {
|
|
|
30303
30556
|
}
|
|
30304
30557
|
|
|
30305
30558
|
|
|
30559
|
+
//# sourceMappingURL=to-plain-object.js.map
|
|
30560
|
+
|
|
30561
|
+
|
|
30306
30562
|
/***/ }),
|
|
30307
30563
|
|
|
30308
30564
|
/***/ "../node_modules/contentful-sdk-core/dist/utils.js":
|
|
@@ -30322,6 +30578,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30322
30578
|
/* harmony export */ });
|
|
30323
30579
|
/* harmony import */ var process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! process */ "../node_modules/process/browser.js");
|
|
30324
30580
|
|
|
30581
|
+
|
|
30325
30582
|
function isNode() {
|
|
30326
30583
|
/**
|
|
30327
30584
|
* Polyfills of 'process' might set process.browser === true
|
|
@@ -30349,6 +30606,9 @@ function noop() {
|
|
|
30349
30606
|
}
|
|
30350
30607
|
|
|
30351
30608
|
|
|
30609
|
+
//# sourceMappingURL=utils.js.map
|
|
30610
|
+
|
|
30611
|
+
|
|
30352
30612
|
/***/ }),
|
|
30353
30613
|
|
|
30354
30614
|
/***/ "../node_modules/fast-copy/dist/esm/index.mjs":
|
|
@@ -30766,136 +31026,6 @@ var index = createCopier({});
|
|
|
30766
31026
|
//# sourceMappingURL=index.mjs.map
|
|
30767
31027
|
|
|
30768
31028
|
|
|
30769
|
-
/***/ }),
|
|
30770
|
-
|
|
30771
|
-
/***/ "../node_modules/p-throttle/index.js":
|
|
30772
|
-
/*!*******************************************!*\
|
|
30773
|
-
!*** ../node_modules/p-throttle/index.js ***!
|
|
30774
|
-
\*******************************************/
|
|
30775
|
-
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
30776
|
-
|
|
30777
|
-
"use strict";
|
|
30778
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30779
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30780
|
-
/* harmony export */ AbortError: function() { return /* binding */ AbortError; },
|
|
30781
|
-
/* harmony export */ "default": function() { return /* binding */ pThrottle; }
|
|
30782
|
-
/* harmony export */ });
|
|
30783
|
-
class AbortError extends Error {
|
|
30784
|
-
constructor() {
|
|
30785
|
-
super('Throttled function aborted');
|
|
30786
|
-
this.name = 'AbortError';
|
|
30787
|
-
}
|
|
30788
|
-
}
|
|
30789
|
-
|
|
30790
|
-
function pThrottle({limit, interval, strict, onDelay}) {
|
|
30791
|
-
if (!Number.isFinite(limit)) {
|
|
30792
|
-
throw new TypeError('Expected `limit` to be a finite number');
|
|
30793
|
-
}
|
|
30794
|
-
|
|
30795
|
-
if (!Number.isFinite(interval)) {
|
|
30796
|
-
throw new TypeError('Expected `interval` to be a finite number');
|
|
30797
|
-
}
|
|
30798
|
-
|
|
30799
|
-
const queue = new Map();
|
|
30800
|
-
|
|
30801
|
-
let currentTick = 0;
|
|
30802
|
-
let activeCount = 0;
|
|
30803
|
-
|
|
30804
|
-
function windowedDelay() {
|
|
30805
|
-
const now = Date.now();
|
|
30806
|
-
|
|
30807
|
-
if ((now - currentTick) > interval) {
|
|
30808
|
-
activeCount = 1;
|
|
30809
|
-
currentTick = now;
|
|
30810
|
-
return 0;
|
|
30811
|
-
}
|
|
30812
|
-
|
|
30813
|
-
if (activeCount < limit) {
|
|
30814
|
-
activeCount++;
|
|
30815
|
-
} else {
|
|
30816
|
-
currentTick += interval;
|
|
30817
|
-
activeCount = 1;
|
|
30818
|
-
}
|
|
30819
|
-
|
|
30820
|
-
return currentTick - now;
|
|
30821
|
-
}
|
|
30822
|
-
|
|
30823
|
-
const strictTicks = [];
|
|
30824
|
-
|
|
30825
|
-
function strictDelay() {
|
|
30826
|
-
const now = Date.now();
|
|
30827
|
-
|
|
30828
|
-
// Clear the queue if there's a significant delay since the last execution
|
|
30829
|
-
if (strictTicks.length > 0 && now - strictTicks.at(-1) > interval) {
|
|
30830
|
-
strictTicks.length = 0;
|
|
30831
|
-
}
|
|
30832
|
-
|
|
30833
|
-
// If the queue is not full, add the current time and execute immediately
|
|
30834
|
-
if (strictTicks.length < limit) {
|
|
30835
|
-
strictTicks.push(now);
|
|
30836
|
-
return 0;
|
|
30837
|
-
}
|
|
30838
|
-
|
|
30839
|
-
// Calculate the next execution time based on the first item in the queue
|
|
30840
|
-
const nextExecutionTime = strictTicks[0] + interval;
|
|
30841
|
-
|
|
30842
|
-
// Shift the queue and add the new execution time
|
|
30843
|
-
strictTicks.shift();
|
|
30844
|
-
strictTicks.push(nextExecutionTime);
|
|
30845
|
-
|
|
30846
|
-
// Calculate the delay for the current execution
|
|
30847
|
-
return Math.max(0, nextExecutionTime - now);
|
|
30848
|
-
}
|
|
30849
|
-
|
|
30850
|
-
const getDelay = strict ? strictDelay : windowedDelay;
|
|
30851
|
-
|
|
30852
|
-
return function_ => {
|
|
30853
|
-
const throttled = function (...arguments_) {
|
|
30854
|
-
if (!throttled.isEnabled) {
|
|
30855
|
-
return (async () => function_.apply(this, arguments_))();
|
|
30856
|
-
}
|
|
30857
|
-
|
|
30858
|
-
let timeoutId;
|
|
30859
|
-
return new Promise((resolve, reject) => {
|
|
30860
|
-
const execute = () => {
|
|
30861
|
-
resolve(function_.apply(this, arguments_));
|
|
30862
|
-
queue.delete(timeoutId);
|
|
30863
|
-
};
|
|
30864
|
-
|
|
30865
|
-
const delay = getDelay();
|
|
30866
|
-
if (delay > 0) {
|
|
30867
|
-
timeoutId = setTimeout(execute, delay);
|
|
30868
|
-
queue.set(timeoutId, reject);
|
|
30869
|
-
onDelay?.(...arguments_);
|
|
30870
|
-
} else {
|
|
30871
|
-
execute();
|
|
30872
|
-
}
|
|
30873
|
-
});
|
|
30874
|
-
};
|
|
30875
|
-
|
|
30876
|
-
throttled.abort = () => {
|
|
30877
|
-
for (const timeout of queue.keys()) {
|
|
30878
|
-
clearTimeout(timeout);
|
|
30879
|
-
queue.get(timeout)(new AbortError());
|
|
30880
|
-
}
|
|
30881
|
-
|
|
30882
|
-
queue.clear();
|
|
30883
|
-
strictTicks.splice(0, strictTicks.length);
|
|
30884
|
-
};
|
|
30885
|
-
|
|
30886
|
-
throttled.isEnabled = true;
|
|
30887
|
-
|
|
30888
|
-
Object.defineProperty(throttled, 'queueSize', {
|
|
30889
|
-
get() {
|
|
30890
|
-
return queue.size;
|
|
30891
|
-
},
|
|
30892
|
-
});
|
|
30893
|
-
|
|
30894
|
-
return throttled;
|
|
30895
|
-
};
|
|
30896
|
-
}
|
|
30897
|
-
|
|
30898
|
-
|
|
30899
31029
|
/***/ })
|
|
30900
31030
|
|
|
30901
31031
|
/******/ });
|