@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 CHANGED
@@ -578,7 +578,7 @@ const getDefaults = () => {
578
578
  * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
579
579
  * @public
580
580
  */
581
- const getDefaultEmulatorHost = (productName) => { var _a, _b; return (_b = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.emulatorHosts) === null || _b === void 0 ? void 0 : _b[productName]; };
581
+ const getDefaultEmulatorHost = (productName) => getDefaults()?.emulatorHosts?.[productName];
582
582
  /**
583
583
  * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
584
584
  * for the given product.
@@ -608,13 +608,13 @@ const getDefaultEmulatorHostnameAndPort = (productName) => {
608
608
  * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
609
609
  * @public
610
610
  */
611
- const getDefaultAppConfig = () => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.config; };
611
+ const getDefaultAppConfig = () => getDefaults()?.config;
612
612
  /**
613
613
  * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
614
614
  * prefixed by "_")
615
615
  * @public
616
616
  */
617
- const getExperimentalSetting = (name) => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a[`_${name}`]; };
617
+ const getExperimentalSetting = (name) => getDefaults()?.[`_${name}`];
618
618
 
619
619
  /**
620
620
  * @license
@@ -702,7 +702,7 @@ function isCloudWorkstation(url) {
702
702
  : url;
703
703
  return host.endsWith('.cloudworkstations.dev');
704
704
  }
705
- catch (_a) {
705
+ catch {
706
706
  return false;
707
707
  }
708
708
  }
@@ -749,12 +749,22 @@ function createMockUserToken(token, projectId) {
749
749
  if (!sub) {
750
750
  throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");
751
751
  }
752
- const payload = Object.assign({
752
+ const payload = {
753
753
  // Set all required fields to decent defaults
754
- iss: `https://securetoken.google.com/${project}`, aud: project, iat, exp: iat + 3600, auth_time: iat, sub, user_id: sub, firebase: {
754
+ iss: `https://securetoken.google.com/${project}`,
755
+ aud: project,
756
+ iat,
757
+ exp: iat + 3600,
758
+ auth_time: iat,
759
+ sub,
760
+ user_id: sub,
761
+ firebase: {
755
762
  sign_in_provider: 'custom',
756
763
  identities: {}
757
- } }, token);
764
+ },
765
+ // Override with user options
766
+ ...token
767
+ };
758
768
  // Unsecured JWTs use the empty string as a signature.
759
769
  const signature = '';
760
770
  return [
@@ -960,8 +970,7 @@ function isMobileCordova() {
960
970
  */
961
971
  // Node detection logic from: https://github.com/iliakan/detect-node/
962
972
  function isNode() {
963
- var _a;
964
- const forceEnvironment = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.forceEnvironment;
973
+ const forceEnvironment = getDefaults()?.forceEnvironment;
965
974
  if (forceEnvironment === 'node') {
966
975
  return true;
967
976
  }
@@ -1088,8 +1097,7 @@ function validateIndexedDBOpenable() {
1088
1097
  preExist = false;
1089
1098
  };
1090
1099
  request.onerror = () => {
1091
- var _a;
1092
- reject(((_a = request.error) === null || _a === void 0 ? void 0 : _a.message) || '');
1100
+ reject(request.error?.message || '');
1093
1101
  };
1094
1102
  }
1095
1103
  catch (error) {