@firebase/util 1.7.3 → 1.8.0
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 +6 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +15 -10
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +15 -10
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +6 -1
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm5.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
@@ -692,7 +697,7 @@ var getDefaults = function () {
|
|
|
692
697
|
* info instead of swallowing so we can find these unknown cases
|
|
693
698
|
* and add paths for them if needed.
|
|
694
699
|
*/
|
|
695
|
-
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "
|
|
700
|
+
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e));
|
|
696
701
|
return;
|
|
697
702
|
}
|
|
698
703
|
};
|
|
@@ -716,7 +721,7 @@ var getDefaultEmulatorHostnameAndPort = function (productName) {
|
|
|
716
721
|
}
|
|
717
722
|
var separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.
|
|
718
723
|
if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {
|
|
719
|
-
throw new Error("Invalid host "
|
|
724
|
+
throw new Error("Invalid host ".concat(host, " with no separate hostname and port!"));
|
|
720
725
|
}
|
|
721
726
|
// eslint-disable-next-line no-restricted-globals
|
|
722
727
|
var port = parseInt(host.substring(separatorIndex + 1), 10);
|
|
@@ -738,7 +743,7 @@ var getDefaultAppConfig = function () { var _a; return (_a = getDefaults()) ===
|
|
|
738
743
|
* prefixed by "_")
|
|
739
744
|
* @public
|
|
740
745
|
*/
|
|
741
|
-
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_"
|
|
746
|
+
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_".concat(name)]; };
|
|
742
747
|
|
|
743
748
|
/**
|
|
744
749
|
* @license
|
|
@@ -831,7 +836,7 @@ function createMockUserToken(token, projectId) {
|
|
|
831
836
|
}
|
|
832
837
|
var payload = __assign({
|
|
833
838
|
// Set all required fields to decent defaults
|
|
834
|
-
iss: "https://securetoken.google.com/"
|
|
839
|
+
iss: "https://securetoken.google.com/".concat(project), aud: project, iat: iat, exp: iat + 3600, auth_time: iat, sub: sub, user_id: sub, firebase: {
|
|
835
840
|
sign_in_provider: 'custom',
|
|
836
841
|
identities: {}
|
|
837
842
|
} }, token);
|
|
@@ -899,11 +904,11 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
899
904
|
data[_i - 1] = arguments[_i];
|
|
900
905
|
}
|
|
901
906
|
var customData = data[0] || {};
|
|
902
|
-
var fullCode = this.service
|
|
907
|
+
var fullCode = "".concat(this.service, "/").concat(code);
|
|
903
908
|
var template = this.errors[code];
|
|
904
909
|
var message = template ? replaceTemplate(template, customData) : 'Error';
|
|
905
910
|
// Service Name: Error message (service/code).
|
|
906
|
-
var fullMessage = this.serviceName
|
|
911
|
+
var fullMessage = "".concat(this.serviceName, ": ").concat(message, " (").concat(fullCode, ").");
|
|
907
912
|
var error = new FirebaseError(fullCode, fullMessage, customData);
|
|
908
913
|
return error;
|
|
909
914
|
};
|
|
@@ -912,7 +917,7 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
912
917
|
function replaceTemplate(template, data) {
|
|
913
918
|
return template.replace(PATTERN, function (_, key) {
|
|
914
919
|
var value = data[key];
|
|
915
|
-
return value != null ? String(value) : "<"
|
|
920
|
+
return value != null ? String(value) : "<".concat(key, "?>");
|
|
916
921
|
});
|
|
917
922
|
}
|
|
918
923
|
var PATTERN = /\{\$([^}]+)}/g;
|
|
@@ -1769,7 +1774,7 @@ var validateArgCount = function (fnName, minCount, maxCount, argCount) {
|
|
|
1769
1774
|
* @return The prefix to add to the error thrown for validation.
|
|
1770
1775
|
*/
|
|
1771
1776
|
function errorPrefix(fnName, argName) {
|
|
1772
|
-
return fnName
|
|
1777
|
+
return "".concat(fnName, " failed: ").concat(argName, " argument ");
|
|
1773
1778
|
}
|
|
1774
1779
|
/**
|
|
1775
1780
|
* @param fnName
|
|
@@ -2011,7 +2016,7 @@ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {
|
|
|
2011
2016
|
*/
|
|
2012
2017
|
function ordinal(i) {
|
|
2013
2018
|
if (!Number.isFinite(i)) {
|
|
2014
|
-
return ""
|
|
2019
|
+
return "".concat(i);
|
|
2015
2020
|
}
|
|
2016
2021
|
return i + indicator(i);
|
|
2017
2022
|
}
|