@firebase/util 1.11.0-firebase-studio-sdk-integration.0615f555a → 1.11.0-firebase-studio-sdk-integration.12759bc2e
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.cjs.js +25 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +25 -4
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +25 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +25 -4
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm2017.js
CHANGED
|
@@ -690,16 +690,37 @@ class Deferred {
|
|
|
690
690
|
function isCloudWorkstation(host) {
|
|
691
691
|
return host.endsWith('.cloudworkstations.dev');
|
|
692
692
|
}
|
|
693
|
+
const pingQueue = {};
|
|
694
|
+
const MAX_PING_RETRIES = 10;
|
|
693
695
|
/**
|
|
694
696
|
* Makes a fetch request to the given server.
|
|
695
697
|
* Mostly used for forwarding cookies in Firebase Studio.
|
|
696
698
|
* @public
|
|
697
699
|
*/
|
|
698
700
|
async function pingServer(endpoint) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
-
|
|
701
|
+
if (pingQueue[endpoint]) {
|
|
702
|
+
return Promise.resolve(false);
|
|
703
|
+
}
|
|
704
|
+
pingQueue[endpoint] = true;
|
|
705
|
+
function waitFor(ms) {
|
|
706
|
+
return new Promise((resolve, reject) => {
|
|
707
|
+
setTimeout(resolve);
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
for (let i = 0; i < MAX_PING_RETRIES; i++) {
|
|
711
|
+
try {
|
|
712
|
+
await waitFor(i * 1000);
|
|
713
|
+
const result = await fetch(endpoint, {
|
|
714
|
+
credentials: 'include'
|
|
715
|
+
});
|
|
716
|
+
if (result.ok) {
|
|
717
|
+
return result.ok;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
catch (_a) { }
|
|
721
|
+
}
|
|
722
|
+
delete pingQueue[endpoint];
|
|
723
|
+
return false;
|
|
703
724
|
}
|
|
704
725
|
|
|
705
726
|
/**
|