free-pi-cli 0.1.0 → 0.1.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/index.js +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14826,8 +14826,20 @@ async function submitConsent(baseUrl, sessionId, consentVersion) {
|
|
|
14826
14826
|
throw new Error(`consent submission failed: HTTP ${res.status}`);
|
|
14827
14827
|
}
|
|
14828
14828
|
async function pollForToken(baseUrl, sessionId, interval, sleep) {
|
|
14829
|
+
let consecutiveNetworkFailures = 0;
|
|
14829
14830
|
for (;; ) {
|
|
14830
|
-
|
|
14831
|
+
let res;
|
|
14832
|
+
try {
|
|
14833
|
+
res = await postJson(baseUrl, "/auth/token", { session_id: sessionId });
|
|
14834
|
+
consecutiveNetworkFailures = 0;
|
|
14835
|
+
} catch (err) {
|
|
14836
|
+
consecutiveNetworkFailures++;
|
|
14837
|
+
if (consecutiveNetworkFailures >= 6) {
|
|
14838
|
+
throw new Error(`token poll failed: network unreachable after ${consecutiveNetworkFailures} attempts (${err instanceof Error ? err.message : String(err)})`);
|
|
14839
|
+
}
|
|
14840
|
+
await sleep(Math.max(interval, 5) * 1000);
|
|
14841
|
+
continue;
|
|
14842
|
+
}
|
|
14831
14843
|
if (res.status === 403) {
|
|
14832
14844
|
const body = await res.json().catch(() => {
|
|
14833
14845
|
return;
|