@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.
@@ -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) => { var _a, _b; return (_b = (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.emulatorHosts) === null || _b === void 0 ? void 0 : _b[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 = () => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a.config; };
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) => { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a[`_${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 (_a) {
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 = Object.assign({
748
+ const payload = {
749
749
  // Set all required fields to decent defaults
750
- iss: `https://securetoken.google.com/${project}`, aud: project, iat, exp: iat + 3600, auth_time: iat, sub, user_id: sub, firebase: {
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
- } }, token);
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
- var _a;
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
- var _a;
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) {
@@ -2307,4 +2315,4 @@ function getModularInstance(service) {
2307
2315
  }
2308
2316
 
2309
2317
  export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isCloudWorkstation, isCloudflareWorker, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isSafariOrWebkit, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, pingServer, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, updateEmulatorBanner, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
2310
- //# sourceMappingURL=index.esm2017.js.map
2318
+ //# sourceMappingURL=index.esm.js.map