@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.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
|
|
@@ -696,7 +701,7 @@ var getDefaults = function () {
|
|
|
696
701
|
* info instead of swallowing so we can find these unknown cases
|
|
697
702
|
* and add paths for them if needed.
|
|
698
703
|
*/
|
|
699
|
-
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "
|
|
704
|
+
console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e));
|
|
700
705
|
return;
|
|
701
706
|
}
|
|
702
707
|
};
|
|
@@ -720,7 +725,7 @@ var getDefaultEmulatorHostnameAndPort = function (productName) {
|
|
|
720
725
|
}
|
|
721
726
|
var separatorIndex = host.lastIndexOf(':'); // Finding the last since IPv6 addr also has colons.
|
|
722
727
|
if (separatorIndex <= 0 || separatorIndex + 1 === host.length) {
|
|
723
|
-
throw new Error("Invalid host "
|
|
728
|
+
throw new Error("Invalid host ".concat(host, " with no separate hostname and port!"));
|
|
724
729
|
}
|
|
725
730
|
// eslint-disable-next-line no-restricted-globals
|
|
726
731
|
var port = parseInt(host.substring(separatorIndex + 1), 10);
|
|
@@ -742,7 +747,7 @@ var getDefaultAppConfig = function () { var _a; return (_a = getDefaults()) ===
|
|
|
742
747
|
* prefixed by "_")
|
|
743
748
|
* @public
|
|
744
749
|
*/
|
|
745
|
-
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_"
|
|
750
|
+
var getExperimentalSetting = function (name) { var _a; return (_a = getDefaults()) === null || _a === void 0 ? void 0 : _a["_".concat(name)]; };
|
|
746
751
|
|
|
747
752
|
/**
|
|
748
753
|
* @license
|
|
@@ -835,7 +840,7 @@ function createMockUserToken(token, projectId) {
|
|
|
835
840
|
}
|
|
836
841
|
var payload = tslib.__assign({
|
|
837
842
|
// Set all required fields to decent defaults
|
|
838
|
-
iss: "https://securetoken.google.com/"
|
|
843
|
+
iss: "https://securetoken.google.com/".concat(project), aud: project, iat: iat, exp: iat + 3600, auth_time: iat, sub: sub, user_id: sub, firebase: {
|
|
839
844
|
sign_in_provider: 'custom',
|
|
840
845
|
identities: {}
|
|
841
846
|
} }, token);
|
|
@@ -903,11 +908,11 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
903
908
|
data[_i - 1] = arguments[_i];
|
|
904
909
|
}
|
|
905
910
|
var customData = data[0] || {};
|
|
906
|
-
var fullCode = this.service
|
|
911
|
+
var fullCode = "".concat(this.service, "/").concat(code);
|
|
907
912
|
var template = this.errors[code];
|
|
908
913
|
var message = template ? replaceTemplate(template, customData) : 'Error';
|
|
909
914
|
// Service Name: Error message (service/code).
|
|
910
|
-
var fullMessage = this.serviceName
|
|
915
|
+
var fullMessage = "".concat(this.serviceName, ": ").concat(message, " (").concat(fullCode, ").");
|
|
911
916
|
var error = new FirebaseError(fullCode, fullMessage, customData);
|
|
912
917
|
return error;
|
|
913
918
|
};
|
|
@@ -916,7 +921,7 @@ var ErrorFactory = /** @class */ (function () {
|
|
|
916
921
|
function replaceTemplate(template, data) {
|
|
917
922
|
return template.replace(PATTERN, function (_, key) {
|
|
918
923
|
var value = data[key];
|
|
919
|
-
return value != null ? String(value) : "<"
|
|
924
|
+
return value != null ? String(value) : "<".concat(key, "?>");
|
|
920
925
|
});
|
|
921
926
|
}
|
|
922
927
|
var PATTERN = /\{\$([^}]+)}/g;
|
|
@@ -1773,7 +1778,7 @@ var validateArgCount = function (fnName, minCount, maxCount, argCount) {
|
|
|
1773
1778
|
* @return The prefix to add to the error thrown for validation.
|
|
1774
1779
|
*/
|
|
1775
1780
|
function errorPrefix(fnName, argName) {
|
|
1776
|
-
return fnName
|
|
1781
|
+
return "".concat(fnName, " failed: ").concat(argName, " argument ");
|
|
1777
1782
|
}
|
|
1778
1783
|
/**
|
|
1779
1784
|
* @param fnName
|
|
@@ -2015,7 +2020,7 @@ function calculateBackoffMillis(backoffCount, intervalMillis, backoffFactor) {
|
|
|
2015
2020
|
*/
|
|
2016
2021
|
function ordinal(i) {
|
|
2017
2022
|
if (!Number.isFinite(i)) {
|
|
2018
|
-
return ""
|
|
2023
|
+
return "".concat(i);
|
|
2019
2024
|
}
|
|
2020
2025
|
return i + indicator(i);
|
|
2021
2026
|
}
|