@firebase/util 1.7.3 → 1.8.0-canary.20e5ef7fb

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.
@@ -560,7 +560,12 @@ function isSafari() {
560
560
  * @return true if indexedDB is supported by current browser/service worker context
561
561
  */
562
562
  function isIndexedDBAvailable() {
563
- return typeof indexedDB === 'object';
563
+ try {
564
+ return typeof indexedDB === 'object';
565
+ }
566
+ catch (e) {
567
+ return false;
568
+ }
564
569
  }
565
570
  /**
566
571
  * This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
@@ -645,8 +650,11 @@ var getDefaultsFromGlobal = function () {
645
650
  };
646
651
  /**
647
652
  * Attempt to read defaults from a JSON string provided to
648
- * process.env.__FIREBASE_DEFAULTS__ or a JSON file whose path is in
649
- * process.env.__FIREBASE_DEFAULTS_PATH__
653
+ * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
654
+ * process(.)env(.)__FIREBASE_DEFAULTS_PATH__
655
+ * The dots are in parens because certain compilers (Vite?) cannot
656
+ * handle seeing that variable in comments.
657
+ * See https://github.com/firebase/firebase-js-sdk/issues/6838
650
658
  */
651
659
  var getDefaultsFromEnvVariable = function () {
652
660
  if (typeof process === 'undefined' || typeof process.env === 'undefined') {
@@ -692,7 +700,7 @@ var getDefaults = function () {
692
700
  * info instead of swallowing so we can find these unknown cases
693
701
  * and add paths for them if needed.
694
702
  */
695
- console.info("Unable to get __FIREBASE_DEFAULTS__ due to: " + e);
703
+ console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e));
696
704
  return;
697
705
  }
698
706
  };
@@ -716,7 +724,7 @@ var getDefaultEmulatorHostnameAndPort = function (productName) {
716
724
  }
717
725
  var separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.
718
726
  if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {
719
- throw new Error("Invalid host " + host + " with no separate hostname and port!");
727
+ throw new Error("Invalid host ".concat(host, " with no separate hostname and port!"));
720
728
  }
721
729
  // eslint-disable-next-line no-restricted-globals
722
730
  var port = parseInt(host.substring(separatorIndex + 1), 10);
@@ -738,7 +746,7 @@ var getDefaultAppConfig = function () { var _a; return (_a = getDefaults()) ===
738
746
  * prefixed by "_")
739
747
  * @public
740
748
  */
741
- var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_" + name]; };
749
+ var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_".concat(name)]; };
742
750
 
743
751
  /**
744
752
  * @license
@@ -831,7 +839,7 @@ function createMockUserToken(token, projectId) {
831
839
  }
832
840
  var payload = __assign({
833
841
  // Set all required fields to decent defaults
834
- iss: "https://securetoken.google.com/" + project, aud: project, iat: iat, exp: iat + 3600, auth_time: iat, sub: sub, user_id: sub, firebase: {
842
+ iss: "https://securetoken.google.com/".concat(project), aud: project, iat: iat, exp: iat + 3600, auth_time: iat, sub: sub, user_id: sub, firebase: {
835
843
  sign_in_provider: 'custom',
836
844
  identities: {}
837
845
  } }, token);
@@ -899,11 +907,11 @@ var ErrorFactory = /** @class */ (function () {
899
907
  data[_i - 1] = arguments[_i];
900
908
  }
901
909
  var customData = data[0] || {};
902
- var fullCode = this.service + "/" + code;
910
+ var fullCode = "".concat(this.service, "/").concat(code);
903
911
  var template = this.errors[code];
904
912
  var message = template ? replaceTemplate(template, customData) : 'Error';
905
913
  // Service Name: Error message (service/code).
906
- var fullMessage = this.serviceName + ": " + message + " (" + fullCode + ").";
914
+ var fullMessage = "".concat(this.serviceName, ": ").concat(message, " (").concat(fullCode, ").");
907
915
  var error = new FirebaseError(fullCode, fullMessage, customData);
908
916
  return error;
909
917
  };
@@ -912,7 +920,7 @@ var ErrorFactory = /** @class */ (function () {
912
920
  function replaceTemplate(template, data) {
913
921
  return template.replace(PATTERN, function (_, key) {
914
922
  var value = data[key];
915
- return value != null ? String(value) : "<" + key + "?>";
923
+ return value != null ? String(value) : "<".concat(key, "?>");
916
924
  });
917
925
  }
918
926
  var PATTERN = /\{\$([^}]+)}/g;
@@ -1769,7 +1777,7 @@ var validateArgCount = function (fnName, minCount, maxCount, argCount) {
1769
1777
  * @return The prefix to add to the error thrown for validation.
1770
1778
  */
1771
1779
  function errorPrefix(fnName, argName) {
1772
- return fnName + " failed: " + argName + " argument ";
1780
+ return "".concat(fnName, " failed: ").concat(argName, " argument ");
1773
1781
  }
1774
1782
  /**
1775
1783
  * @param fnName
@@ -2011,7 +2019,7 @@ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {
2011
2019
  */
2012
2020
  function ordinal(i) {
2013
2021
  if (!Number.isFinite(i)) {
2014
- return "" + i;
2022
+ return "".concat(i);
2015
2023
  }
2016
2024
  return i + indicator(i);
2017
2025
  }