@firebase/util 1.11.0-firebase-studio-sdk-integration.bffdabd70 → 1.11.0-firebase-studio-sdk-integration.fe1264c00
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 +99 -49
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +99 -49
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +99 -49
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +99 -49
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -667,6 +667,41 @@ class Deferred {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
+
/**
|
|
671
|
+
* @license
|
|
672
|
+
* Copyright 2025 Google LLC
|
|
673
|
+
*
|
|
674
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
675
|
+
* you may not use this file except in compliance with the License.
|
|
676
|
+
* You may obtain a copy of the License at
|
|
677
|
+
*
|
|
678
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
679
|
+
*
|
|
680
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
681
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
682
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
683
|
+
* See the License for the specific language governing permissions and
|
|
684
|
+
* limitations under the License.
|
|
685
|
+
*/
|
|
686
|
+
/**
|
|
687
|
+
* Checks whether host is a cloud workstation or not.
|
|
688
|
+
* @public
|
|
689
|
+
*/
|
|
690
|
+
function isCloudWorkstation(host) {
|
|
691
|
+
return host.endsWith('.cloudworkstations.dev');
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Makes a fetch request to the given server.
|
|
695
|
+
* Mostly used for forwarding cookies in Firebase Studio.
|
|
696
|
+
* @public
|
|
697
|
+
*/
|
|
698
|
+
async function pingServer(endpoint) {
|
|
699
|
+
const result = await fetch(endpoint, {
|
|
700
|
+
credentials: 'include'
|
|
701
|
+
});
|
|
702
|
+
return result.ok;
|
|
703
|
+
}
|
|
704
|
+
|
|
670
705
|
/**
|
|
671
706
|
* @license
|
|
672
707
|
* Copyright 2021 Google LLC
|
|
@@ -714,14 +749,20 @@ function createMockUserToken(token, projectId) {
|
|
|
714
749
|
}
|
|
715
750
|
const emulatorStatus = {};
|
|
716
751
|
// Checks whether any products are running on an emulator
|
|
717
|
-
function
|
|
718
|
-
|
|
752
|
+
function getEmulatorSummary() {
|
|
753
|
+
const summary = {
|
|
754
|
+
prod: [],
|
|
755
|
+
emulator: []
|
|
756
|
+
};
|
|
719
757
|
for (const key of Object.keys(emulatorStatus)) {
|
|
720
758
|
if (emulatorStatus[key]) {
|
|
721
|
-
|
|
759
|
+
summary.emulator.push(key);
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
summary.prod.push(key);
|
|
722
763
|
}
|
|
723
764
|
}
|
|
724
|
-
return
|
|
765
|
+
return summary;
|
|
725
766
|
}
|
|
726
767
|
function getOrCreateEl(id) {
|
|
727
768
|
let parentDiv = document.getElementById(id);
|
|
@@ -733,6 +774,7 @@ function getOrCreateEl(id) {
|
|
|
733
774
|
}
|
|
734
775
|
return { created, element: parentDiv };
|
|
735
776
|
}
|
|
777
|
+
let previouslyDismissed = false;
|
|
736
778
|
/**
|
|
737
779
|
* Updates Emulator Banner. Primarily used for Firebase Studio
|
|
738
780
|
* @param name
|
|
@@ -742,15 +784,18 @@ function getOrCreateEl(id) {
|
|
|
742
784
|
function updateEmulatorBanner(name, isRunningEmulator) {
|
|
743
785
|
if (typeof window === 'undefined' ||
|
|
744
786
|
typeof document === 'undefined' ||
|
|
745
|
-
|
|
787
|
+
!isCloudWorkstation(window.location.host) ||
|
|
788
|
+
emulatorStatus[name] === isRunningEmulator ||
|
|
789
|
+
previouslyDismissed) {
|
|
746
790
|
return;
|
|
747
791
|
}
|
|
748
792
|
emulatorStatus[name] = isRunningEmulator;
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
tearDown();
|
|
752
|
-
return;
|
|
793
|
+
function prefixedId(id) {
|
|
794
|
+
return `__firebase__banner__${id}`;
|
|
753
795
|
}
|
|
796
|
+
const bannerId = '__firebase__banner';
|
|
797
|
+
const summary = getEmulatorSummary();
|
|
798
|
+
const showError = summary.prod.length > 0;
|
|
754
799
|
function tearDown() {
|
|
755
800
|
const element = document.getElementById(bannerId);
|
|
756
801
|
if (element) {
|
|
@@ -759,8 +804,14 @@ function updateEmulatorBanner(name, isRunningEmulator) {
|
|
|
759
804
|
}
|
|
760
805
|
function setupDom() {
|
|
761
806
|
const banner = getOrCreateEl(bannerId);
|
|
762
|
-
const
|
|
763
|
-
|
|
807
|
+
const firebaseTextId = prefixedId('text');
|
|
808
|
+
const firebaseText = document.getElementById(firebaseTextId) || document.createElement('span');
|
|
809
|
+
const learnMoreId = prefixedId('learnmore');
|
|
810
|
+
const learnMoreLink = document.getElementById(learnMoreId) ||
|
|
811
|
+
document.createElement('a');
|
|
812
|
+
const prependIconId = prefixedId('preprendIcon');
|
|
813
|
+
const prependIcon = document.getElementById(prependIconId) ||
|
|
814
|
+
document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
764
815
|
if (banner.created) {
|
|
765
816
|
// update styles
|
|
766
817
|
const bannerEl = banner.element;
|
|
@@ -777,14 +828,48 @@ function updateEmulatorBanner(name, isRunningEmulator) {
|
|
|
777
828
|
closeBtn.style.paddingLeft = '5px';
|
|
778
829
|
closeBtn.innerHTML = ' ×';
|
|
779
830
|
closeBtn.onclick = () => {
|
|
831
|
+
previouslyDismissed = true;
|
|
780
832
|
tearDown();
|
|
781
833
|
};
|
|
834
|
+
learnMoreLink.setAttribute('id', learnMoreId);
|
|
835
|
+
learnMoreLink.href =
|
|
836
|
+
'http://firebase.google.com/docs/studio/deploy-app#emulator ';
|
|
837
|
+
bannerEl.appendChild(prependIcon);
|
|
782
838
|
bannerEl.appendChild(firebaseText);
|
|
839
|
+
bannerEl.appendChild(learnMoreLink);
|
|
783
840
|
bannerEl.appendChild(closeBtn);
|
|
784
|
-
|
|
841
|
+
prependIcon.setAttribute('width', '24');
|
|
842
|
+
prependIcon.setAttribute('id', prependIconId);
|
|
843
|
+
prependIcon.setAttribute('height', '24');
|
|
844
|
+
prependIcon.setAttribute('viewBox', '0 0 24 24');
|
|
845
|
+
prependIcon.setAttribute('fill', 'none');
|
|
846
|
+
document.body.appendChild(bannerEl);
|
|
847
|
+
}
|
|
848
|
+
if (showError) {
|
|
849
|
+
firebaseText.innerText = `Running in Production`;
|
|
850
|
+
prependIcon.innerHTML = `<g clip-path="url(#clip0_6013_33858)">
|
|
851
|
+
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
|
|
852
|
+
</g>
|
|
853
|
+
<defs>
|
|
854
|
+
<clipPath id="clip0_6013_33858">
|
|
855
|
+
<rect width="24" height="24" fill="white"/>
|
|
856
|
+
</clipPath>
|
|
857
|
+
</defs>`;
|
|
785
858
|
}
|
|
786
|
-
|
|
787
|
-
|
|
859
|
+
else {
|
|
860
|
+
prependIcon.innerHTML = `<g clip-path="url(#clip0_6083_34804)">
|
|
861
|
+
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
|
|
862
|
+
</g>
|
|
863
|
+
<defs>
|
|
864
|
+
<clipPath id="clip0_6083_34804">
|
|
865
|
+
<rect width="24" height="24" fill="white"/>
|
|
866
|
+
</clipPath>
|
|
867
|
+
</defs>`;
|
|
868
|
+
firebaseText.innerText = 'Using emulated backend';
|
|
869
|
+
learnMoreLink.href =
|
|
870
|
+
'https://firebase.google.com/docs/studio/solution-build-with-ai';
|
|
871
|
+
}
|
|
872
|
+
firebaseText.setAttribute('id', firebaseTextId);
|
|
788
873
|
}
|
|
789
874
|
if (document.readyState === 'loading') {
|
|
790
875
|
window.addEventListener('DOMContentLoaded', setupDom);
|
|
@@ -2186,41 +2271,6 @@ function getModularInstance(service) {
|
|
|
2186
2271
|
}
|
|
2187
2272
|
}
|
|
2188
2273
|
|
|
2189
|
-
/**
|
|
2190
|
-
* @license
|
|
2191
|
-
* Copyright 2025 Google LLC
|
|
2192
|
-
*
|
|
2193
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2194
|
-
* you may not use this file except in compliance with the License.
|
|
2195
|
-
* You may obtain a copy of the License at
|
|
2196
|
-
*
|
|
2197
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2198
|
-
*
|
|
2199
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2200
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2201
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2202
|
-
* See the License for the specific language governing permissions and
|
|
2203
|
-
* limitations under the License.
|
|
2204
|
-
*/
|
|
2205
|
-
/**
|
|
2206
|
-
* Checks whether host is a cloud workstation or not.
|
|
2207
|
-
* @public
|
|
2208
|
-
*/
|
|
2209
|
-
function isCloudWorkstation(host) {
|
|
2210
|
-
return host.endsWith('.cloudworkstations.dev');
|
|
2211
|
-
}
|
|
2212
|
-
/**
|
|
2213
|
-
* Makes a fetch request to the given server.
|
|
2214
|
-
* Mostly used for forwarding cookies in Firebase Studio.
|
|
2215
|
-
* @public
|
|
2216
|
-
*/
|
|
2217
|
-
async function pingServer(endpoint) {
|
|
2218
|
-
const result = await fetch(endpoint, {
|
|
2219
|
-
credentials: 'include'
|
|
2220
|
-
});
|
|
2221
|
-
return result.ok;
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
2274
|
/**
|
|
2225
2275
|
* @license
|
|
2226
2276
|
* Copyright 2017 Google LLC
|