@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.
- package/CHANGELOG.md +10 -0
- package/dist/index.esm2017.js +11 -3
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +20 -12
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +20 -12
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +11 -3
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.node.cjs.js
CHANGED
|
@@ -564,7 +564,12 @@ function isSafari() {
|
|
|
564
564
|
* @return true if indexedDB is supported by current browser/service worker context
|
|
565
565
|
*/
|
|
566
566
|
function isIndexedDBAvailable() {
|
|
567
|
-
|
|
567
|
+
try {
|
|
568
|
+
return typeof indexedDB === 'object';
|
|
569
|
+
}
|
|
570
|
+
catch (e) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
568
573
|
}
|
|
569
574
|
/**
|
|
570
575
|
* This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
|
|
@@ -649,8 +654,11 @@ var getDefaultsFromGlobal = function () {
|
|
|
649
654
|
};
|
|
650
655
|
/**
|
|
651
656
|
* Attempt to read defaults from a JSON string provided to
|
|
652
|
-
* process.env.__FIREBASE_DEFAULTS__ or a JSON file whose path is in
|
|
653
|
-
* process.env.__FIREBASE_DEFAULTS_PATH__
|
|
657
|
+
* process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
|
|
658
|
+
* process(.)env(.)__FIREBASE_DEFAULTS_PATH__
|
|
659
|
+
* The dots are in parens because certain compilers (Vite?) cannot
|
|
660
|
+
* handle seeing that variable in comments.
|
|
661
|
+
* See https://github.com/firebase/firebase-js-sdk/issues/6838
|
|
654
662
|
*/
|
|
655
663
|
var getDefaultsFromEnvVariable = function () {
|
|
656
664
|
if (typeof process === 'undefined' || typeof process.env === 'undefined') {
|
|
@@ -696,7 +704,7 @@ var getDefaults = function () {
|
|
|
696
704
|
* info instead of swallowing so we can find these unknown cases
|
|
697
705
|
* and add paths for them if needed.
|
|
698
706
|
*/
|
|
699
|
-
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "
|
|
707
|
+
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e));
|
|
700
708
|
return;
|
|
701
709
|
}
|
|
702
710
|
};
|
|
@@ -720,7 +728,7 @@ var getDefaultEmulatorHostnameAndPort = function (productName) {
|
|
|
720
728
|
}
|
|
721
729
|
var separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.
|
|
722
730
|
if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {
|
|
723
|
-
throw new Error("Invalid host "
|
|
731
|
+
throw new Error("Invalid host ".concat(host, " with no separate hostname and port!"));
|
|
724
732
|
}
|
|
725
733
|
// eslint-disable-next-line no-restricted-globals
|
|
726
734
|
var port = parseInt(host.substring(separatorIndex + 1), 10);
|
|
@@ -742,7 +750,7 @@ var getDefaultAppConfig = function () { var _a; return (_a = getDefaults()) ===
|
|
|
742
750
|
* prefixed by "_")
|
|
743
751
|
* @public
|
|
744
752
|
*/
|
|
745
|
-
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_"
|
|
753
|
+
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_".concat(name)]; };
|
|
746
754
|
|
|
747
755
|
/**
|
|
748
756
|
* @license
|
|
@@ -835,7 +843,7 @@ function createMockUserToken(token, projectId) {
|
|
|
835
843
|
}
|
|
836
844
|
var payload = tslib.__assign({
|
|
837
845
|
// Set all required fields to decent defaults
|
|
838
|
-
iss: "https://securetoken.google.com/"
|
|
846
|
+
iss: "https://securetoken.google.com/".concat(project), aud: project, iat: iat, exp: iat + 3600, auth_time: iat, sub: sub, user_id: sub, firebase: {
|
|
839
847
|
sign_in_provider: 'custom',
|
|
840
848
|
identities: {}
|
|
841
849
|
} }, token);
|
|
@@ -903,11 +911,11 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
903
911
|
data[_i - 1] = arguments[_i];
|
|
904
912
|
}
|
|
905
913
|
var customData = data[0] || {};
|
|
906
|
-
var fullCode = this.service
|
|
914
|
+
var fullCode = "".concat(this.service, "/").concat(code);
|
|
907
915
|
var template = this.errors[code];
|
|
908
916
|
var message = template ? replaceTemplate(template, customData) : 'Error';
|
|
909
917
|
// Service Name: Error message (service/code).
|
|
910
|
-
var fullMessage = this.serviceName
|
|
918
|
+
var fullMessage = "".concat(this.serviceName, ": ").concat(message, " (").concat(fullCode, ").");
|
|
911
919
|
var error = new FirebaseError(fullCode, fullMessage, customData);
|
|
912
920
|
return error;
|
|
913
921
|
};
|
|
@@ -916,7 +924,7 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
916
924
|
function replaceTemplate(template, data) {
|
|
917
925
|
return template.replace(PATTERN, function (_, key) {
|
|
918
926
|
var value = data[key];
|
|
919
|
-
return value != null ? String(value) : "<"
|
|
927
|
+
return value != null ? String(value) : "<".concat(key, "?>");
|
|
920
928
|
});
|
|
921
929
|
}
|
|
922
930
|
var PATTERN = /\{\$([^}]+)}/g;
|
|
@@ -1773,7 +1781,7 @@ var validateArgCount = function (fnName, minCount, maxCount, argCount) {
|
|
|
1773
1781
|
* @return The prefix to add to the error thrown for validation.
|
|
1774
1782
|
*/
|
|
1775
1783
|
function errorPrefix(fnName, argName) {
|
|
1776
|
-
return fnName
|
|
1784
|
+
return "".concat(fnName, " failed: ").concat(argName, " argument ");
|
|
1777
1785
|
}
|
|
1778
1786
|
/**
|
|
1779
1787
|
* @param fnName
|
|
@@ -2015,7 +2023,7 @@ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {
|
|
|
2015
2023
|
*/
|
|
2016
2024
|
function ordinal(i) {
|
|
2017
2025
|
if (!Number.isFinite(i)) {
|
|
2018
|
-
return ""
|
|
2026
|
+
return "".concat(i);
|
|
2019
2027
|
}
|
|
2020
2028
|
return i + indicator(i);
|
|
2021
2029
|
}
|