@zapier/kitcore 0.17.1 → 0.17.2
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/CHANGELOG.md +8 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4930,6 +4930,7 @@ var DEFAULT_IDEMPOTENT_METHODS = [
|
|
|
4930
4930
|
];
|
|
4931
4931
|
var BASE_BACKOFF_MILLISECONDS = 1e3;
|
|
4932
4932
|
var JITTER_FACTOR = 0.5;
|
|
4933
|
+
var EPOCH_THRESHOLD_SECONDS = 1e9;
|
|
4933
4934
|
function directedDelayMilliseconds(response) {
|
|
4934
4935
|
const retryAfter = response.headers.get("retry-after");
|
|
4935
4936
|
if (retryAfter) {
|
|
@@ -4938,11 +4939,12 @@ function directedDelayMilliseconds(response) {
|
|
|
4938
4939
|
const date = Date.parse(retryAfter);
|
|
4939
4940
|
if (!Number.isNaN(date)) return Math.max(0, date - Date.now());
|
|
4940
4941
|
}
|
|
4942
|
+
if (response.status !== 429) return void 0;
|
|
4941
4943
|
const reset = response.headers.get("x-ratelimit-reset");
|
|
4942
4944
|
if (reset) {
|
|
4943
|
-
const
|
|
4944
|
-
if (!Number.isNaN(
|
|
4945
|
-
return Math.max(0,
|
|
4945
|
+
const resetValue = Number.parseInt(reset, 10);
|
|
4946
|
+
if (!Number.isNaN(resetValue)) {
|
|
4947
|
+
return resetValue >= EPOCH_THRESHOLD_SECONDS ? Math.max(0, resetValue * 1e3 - Date.now()) : Math.max(0, resetValue * 1e3);
|
|
4946
4948
|
}
|
|
4947
4949
|
}
|
|
4948
4950
|
return void 0;
|