@firebase/util 1.12.1 → 1.13.0-20250716004940
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 +19 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/{index.esm2017.js → index.esm.js} +20 -12
- package/dist/index.esm.js.map +1 -0
- package/dist/index.node.cjs.js +19 -11
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +19 -11
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +6 -6
- package/dist/index.esm2017.js.map +0 -1
|
@@ -574,7 +574,7 @@ const getDefaults = () => {
|
|
|
574
574
|
* @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
|
|
575
575
|
* @public
|
|
576
576
|
*/
|
|
577
|
-
const getDefaultEmulatorHost = (productName) =>
|
|
577
|
+
const getDefaultEmulatorHost = (productName) => getDefaults()?.emulatorHosts?.[productName];
|
|
578
578
|
/**
|
|
579
579
|
* Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
|
|
580
580
|
* for the given product.
|
|
@@ -604,13 +604,13 @@ const getDefaultEmulatorHostnameAndPort = (productName) => {
|
|
|
604
604
|
* Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
|
|
605
605
|
* @public
|
|
606
606
|
*/
|
|
607
|
-
const getDefaultAppConfig = () =>
|
|
607
|
+
const getDefaultAppConfig = () => getDefaults()?.config;
|
|
608
608
|
/**
|
|
609
609
|
* Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
|
|
610
610
|
* prefixed by "_")
|
|
611
611
|
* @public
|
|
612
612
|
*/
|
|
613
|
-
const getExperimentalSetting = (name) =>
|
|
613
|
+
const getExperimentalSetting = (name) => getDefaults()?.[`_${name}`];
|
|
614
614
|
|
|
615
615
|
/**
|
|
616
616
|
* @license
|
|
@@ -698,7 +698,7 @@ function isCloudWorkstation(url) {
|
|
|
698
698
|
: url;
|
|
699
699
|
return host.endsWith('.cloudworkstations.dev');
|
|
700
700
|
}
|
|
701
|
-
catch
|
|
701
|
+
catch {
|
|
702
702
|
return false;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
@@ -745,12 +745,22 @@ function createMockUserToken(token, projectId) {
|
|
|
745
745
|
if (!sub) {
|
|
746
746
|
throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");
|
|
747
747
|
}
|
|
748
|
-
const payload =
|
|
748
|
+
const payload = {
|
|
749
749
|
// Set all required fields to decent defaults
|
|
750
|
-
iss: `https://securetoken.google.com/${project}`,
|
|
750
|
+
iss: `https://securetoken.google.com/${project}`,
|
|
751
|
+
aud: project,
|
|
752
|
+
iat,
|
|
753
|
+
exp: iat + 3600,
|
|
754
|
+
auth_time: iat,
|
|
755
|
+
sub,
|
|
756
|
+
user_id: sub,
|
|
757
|
+
firebase: {
|
|
751
758
|
sign_in_provider: 'custom',
|
|
752
759
|
identities: {}
|
|
753
|
-
}
|
|
760
|
+
},
|
|
761
|
+
// Override with user options
|
|
762
|
+
...token
|
|
763
|
+
};
|
|
754
764
|
// Unsecured JWTs use the empty string as a signature.
|
|
755
765
|
const signature = '';
|
|
756
766
|
return [
|
|
@@ -956,8 +966,7 @@ function isMobileCordova() {
|
|
|
956
966
|
*/
|
|
957
967
|
// Node detection logic from: https://github.com/iliakan/detect-node/
|
|
958
968
|
function isNode() {
|
|
959
|
-
|
|
960
|
-
const forceEnvironment = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.forceEnvironment;
|
|
969
|
+
const forceEnvironment = getDefaults()?.forceEnvironment;
|
|
961
970
|
if (forceEnvironment === 'node') {
|
|
962
971
|
return true;
|
|
963
972
|
}
|
|
@@ -1084,8 +1093,7 @@ function validateIndexedDBOpenable() {
|
|
|
1084
1093
|
preExist = false;
|
|
1085
1094
|
};
|
|
1086
1095
|
request.onerror = () => {
|
|
1087
|
-
|
|
1088
|
-
reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || '');
|
|
1096
|
+
reject(request.error?.message || '');
|
|
1089
1097
|
};
|
|
1090
1098
|
}
|
|
1091
1099
|
catch (error) {
|