@plasius/analytics 1.2.0 → 1.2.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/README.md +5 -0
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1980,15 +1980,19 @@ function isSecureSemanticJourneyEndpoint(endpoint, baseUrl) {
|
|
|
1980
1980
|
return false;
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
+
var HTTP_DATE_PATTERN = /^(?:[A-Za-z]{3}, \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT|[A-Za-z]+, \d{2}-[A-Za-z]{3}-\d{2} \d{2}:\d{2}:\d{2} GMT|[A-Za-z]{3} [A-Za-z]{3} [ \d]\d \d{2}:\d{2}:\d{2} \d{4})$/u;
|
|
1983
1984
|
function parseRetryAfter(value, nowEpochMs) {
|
|
1984
1985
|
if (!value) {
|
|
1985
1986
|
return void 0;
|
|
1986
1987
|
}
|
|
1987
|
-
const
|
|
1988
|
-
if (
|
|
1989
|
-
return Math.min(MAX_RETRY_AFTER_MS,
|
|
1988
|
+
const trimmed = value.trim();
|
|
1989
|
+
if (/^(0|[1-9]\d*)$/u.test(trimmed)) {
|
|
1990
|
+
return Math.min(MAX_RETRY_AFTER_MS, Number(trimmed) * 1e3);
|
|
1990
1991
|
}
|
|
1991
|
-
|
|
1992
|
+
if (!HTTP_DATE_PATTERN.test(trimmed)) {
|
|
1993
|
+
return void 0;
|
|
1994
|
+
}
|
|
1995
|
+
const dateEpochMs = Date.parse(trimmed);
|
|
1992
1996
|
if (!Number.isFinite(dateEpochMs)) {
|
|
1993
1997
|
return void 0;
|
|
1994
1998
|
}
|