@firebase/remote-config 0.3.15 → 0.4.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 +14 -0
- package/dist/esm/index.esm.js +63 -69
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/index.esm2017.js +43 -49
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/index.cjs.js +63 -69
- package/dist/index.cjs.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @firebase/remote-config
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be) [#6799](https://github.com/firebase/firebase-js-sdk/pull/6799) - Update TypeScript version to 4.7.4.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`c20633ed3`](https://github.com/firebase/firebase-js-sdk/commit/c20633ed35056cbadc9d65d9ceddf4e28d1ea666), [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be)]:
|
|
12
|
+
- @firebase/util@1.8.0
|
|
13
|
+
- @firebase/component@0.6.0
|
|
14
|
+
- @firebase/installations@0.6.0
|
|
15
|
+
- @firebase/logger@0.4.0
|
|
16
|
+
|
|
3
17
|
## 0.3.15
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { __awaiter, __generator, __assign } from 'tslib';
|
|
|
6
6
|
import '@firebase/installations';
|
|
7
7
|
|
|
8
8
|
var name = "@firebase/remote-config";
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.4.0";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -81,25 +81,25 @@ var RC_COMPONENT_NAME = 'remote-config';
|
|
|
81
81
|
*/
|
|
82
82
|
var _a;
|
|
83
83
|
var ERROR_DESCRIPTION_MAP = (_a = {},
|
|
84
|
-
_a["registration-window" /* REGISTRATION_WINDOW */] = 'Undefined window object. This SDK only supports usage in a browser environment.',
|
|
85
|
-
_a["registration-project-id" /* REGISTRATION_PROJECT_ID */] = 'Undefined project identifier. Check Firebase app initialization.',
|
|
86
|
-
_a["registration-api-key" /* REGISTRATION_API_KEY */] = 'Undefined API key. Check Firebase app initialization.',
|
|
87
|
-
_a["registration-app-id" /* REGISTRATION_APP_ID */] = 'Undefined app identifier. Check Firebase app initialization.',
|
|
88
|
-
_a["storage-open" /* STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
|
|
89
|
-
_a["storage-get" /* STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
|
|
90
|
-
_a["storage-set" /* STORAGE_SET */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
|
|
91
|
-
_a["storage-delete" /* STORAGE_DELETE */] = 'Error thrown when deleting from storage. Original error: {$originalErrorMessage}.',
|
|
92
|
-
_a["fetch-client-network" /* FETCH_NETWORK */] = 'Fetch client failed to connect to a network. Check Internet connection.' +
|
|
84
|
+
_a["registration-window" /* ErrorCode.REGISTRATION_WINDOW */] = 'Undefined window object. This SDK only supports usage in a browser environment.',
|
|
85
|
+
_a["registration-project-id" /* ErrorCode.REGISTRATION_PROJECT_ID */] = 'Undefined project identifier. Check Firebase app initialization.',
|
|
86
|
+
_a["registration-api-key" /* ErrorCode.REGISTRATION_API_KEY */] = 'Undefined API key. Check Firebase app initialization.',
|
|
87
|
+
_a["registration-app-id" /* ErrorCode.REGISTRATION_APP_ID */] = 'Undefined app identifier. Check Firebase app initialization.',
|
|
88
|
+
_a["storage-open" /* ErrorCode.STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
|
|
89
|
+
_a["storage-get" /* ErrorCode.STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
|
|
90
|
+
_a["storage-set" /* ErrorCode.STORAGE_SET */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
|
|
91
|
+
_a["storage-delete" /* ErrorCode.STORAGE_DELETE */] = 'Error thrown when deleting from storage. Original error: {$originalErrorMessage}.',
|
|
92
|
+
_a["fetch-client-network" /* ErrorCode.FETCH_NETWORK */] = 'Fetch client failed to connect to a network. Check Internet connection.' +
|
|
93
93
|
' Original error: {$originalErrorMessage}.',
|
|
94
|
-
_a["fetch-timeout" /* FETCH_TIMEOUT */] = 'The config fetch request timed out. ' +
|
|
94
|
+
_a["fetch-timeout" /* ErrorCode.FETCH_TIMEOUT */] = 'The config fetch request timed out. ' +
|
|
95
95
|
' Configure timeout using "fetchTimeoutMillis" SDK setting.',
|
|
96
|
-
_a["fetch-throttle" /* FETCH_THROTTLE */] = 'The config fetch request timed out while in an exponential backoff state.' +
|
|
96
|
+
_a["fetch-throttle" /* ErrorCode.FETCH_THROTTLE */] = 'The config fetch request timed out while in an exponential backoff state.' +
|
|
97
97
|
' Configure timeout using "fetchTimeoutMillis" SDK setting.' +
|
|
98
98
|
' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',
|
|
99
|
-
_a["fetch-client-parse" /* FETCH_PARSE */] = 'Fetch client could not parse response.' +
|
|
99
|
+
_a["fetch-client-parse" /* ErrorCode.FETCH_PARSE */] = 'Fetch client could not parse response.' +
|
|
100
100
|
' Original error: {$originalErrorMessage}.',
|
|
101
|
-
_a["fetch-status" /* FETCH_STATUS */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
|
|
102
|
-
_a["indexed-db-unavailable" /* INDEXED_DB_UNAVAILABLE */] = 'Indexed DB is not supported by current browser',
|
|
101
|
+
_a["fetch-status" /* ErrorCode.FETCH_STATUS */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
|
|
102
|
+
_a["indexed-db-unavailable" /* ErrorCode.INDEXED_DB_UNAVAILABLE */] = 'Indexed DB is not supported by current browser',
|
|
103
103
|
_a);
|
|
104
104
|
var ERROR_FACTORY = new ErrorFactory('remoteconfig' /* service */, 'Remote Config' /* service name */, ERROR_DESCRIPTION_MAP);
|
|
105
105
|
// Note how this is like typeof/instanceof, but for ErrorCode.
|
|
@@ -279,7 +279,7 @@ function fetchConfig(remoteConfig) {
|
|
|
279
279
|
return [3 /*break*/, 6];
|
|
280
280
|
case 4:
|
|
281
281
|
e_1 = _a.sent();
|
|
282
|
-
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */)
|
|
282
|
+
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* ErrorCode.FETCH_THROTTLE */)
|
|
283
283
|
? 'throttle'
|
|
284
284
|
: 'failure';
|
|
285
285
|
return [4 /*yield*/, rc._storageCache.setLastFetchStatus(lastFetchStatus)];
|
|
@@ -362,7 +362,7 @@ function getString(remoteConfig, key) {
|
|
|
362
362
|
function getValue(remoteConfig, key) {
|
|
363
363
|
var rc = getModularInstance(remoteConfig);
|
|
364
364
|
if (!rc._isInitializationComplete) {
|
|
365
|
-
rc._logger.debug("A value was requested for key \""
|
|
365
|
+
rc._logger.debug("A value was requested for key \"".concat(key, "\" before SDK initialization completed.") +
|
|
366
366
|
' Await on ensureInitialized if the intent was to get a previously activated value.');
|
|
367
367
|
}
|
|
368
368
|
var activeConfig = rc._storageCache.getActiveConfig();
|
|
@@ -372,7 +372,7 @@ function getValue(remoteConfig, key) {
|
|
|
372
372
|
else if (rc.defaultConfig && rc.defaultConfig[key] !== undefined) {
|
|
373
373
|
return new Value('default', String(rc.defaultConfig[key]));
|
|
374
374
|
}
|
|
375
|
-
rc._logger.debug("Returning static value for key \""
|
|
375
|
+
rc._logger.debug("Returning static value for key \"".concat(key, "\".") +
|
|
376
376
|
' Define a default or remote value if this is unintentional.');
|
|
377
377
|
return new Value('static');
|
|
378
378
|
}
|
|
@@ -455,9 +455,9 @@ var CachingClient = /** @class */ (function () {
|
|
|
455
455
|
var cacheAgeMillis = Date.now() - lastSuccessfulFetchTimestampMillis;
|
|
456
456
|
var isCachedDataFresh = cacheAgeMillis <= cacheMaxAgeMillis;
|
|
457
457
|
this.logger.debug('Config fetch cache check.' +
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
458
|
+
" Cache age millis: ".concat(cacheAgeMillis, ".") +
|
|
459
|
+
" Cache max age millis (minimumFetchIntervalMillis setting): ".concat(cacheMaxAgeMillis, ".") +
|
|
460
|
+
" Is cache hit: ".concat(isCachedDataFresh, "."));
|
|
461
461
|
return isCachedDataFresh;
|
|
462
462
|
};
|
|
463
463
|
CachingClient.prototype.fetch = function (request) {
|
|
@@ -577,20 +577,19 @@ var RestClient = /** @class */ (function () {
|
|
|
577
577
|
* @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status.
|
|
578
578
|
*/
|
|
579
579
|
RestClient.prototype.fetch = function (request) {
|
|
580
|
-
var _a, _b, _c;
|
|
581
580
|
return __awaiter(this, void 0, void 0, function () {
|
|
582
|
-
var
|
|
583
|
-
return __generator(this, function (
|
|
584
|
-
switch (
|
|
581
|
+
var _a, installationId, installationToken, urlBase, url, headers, requestBody, options, fetchPromise, timeoutPromise, response, originalError_1, errorCode, status, responseEtag, config, state, responseBody, originalError_2;
|
|
582
|
+
return __generator(this, function (_b) {
|
|
583
|
+
switch (_b.label) {
|
|
585
584
|
case 0: return [4 /*yield*/, Promise.all([
|
|
586
585
|
this.firebaseInstallations.getId(),
|
|
587
586
|
this.firebaseInstallations.getToken()
|
|
588
587
|
])];
|
|
589
588
|
case 1:
|
|
590
|
-
|
|
589
|
+
_a = _b.sent(), installationId = _a[0], installationToken = _a[1];
|
|
591
590
|
urlBase = window.FIREBASE_REMOTE_CONFIG_URL_BASE ||
|
|
592
591
|
'https://firebaseremoteconfig.googleapis.com';
|
|
593
|
-
url = urlBase
|
|
592
|
+
url = "".concat(urlBase, "/v1/projects/").concat(this.projectId, "/namespaces/").concat(this.namespace, ":fetch?key=").concat(this.apiKey);
|
|
594
593
|
headers = {
|
|
595
594
|
'Content-Type': 'application/json',
|
|
596
595
|
'Content-Encoding': 'gzip',
|
|
@@ -622,46 +621,46 @@ var RestClient = /** @class */ (function () {
|
|
|
622
621
|
reject(error);
|
|
623
622
|
});
|
|
624
623
|
});
|
|
625
|
-
|
|
624
|
+
_b.label = 2;
|
|
626
625
|
case 2:
|
|
627
|
-
|
|
626
|
+
_b.trys.push([2, 5, , 6]);
|
|
628
627
|
return [4 /*yield*/, Promise.race([fetchPromise, timeoutPromise])];
|
|
629
628
|
case 3:
|
|
630
|
-
|
|
629
|
+
_b.sent();
|
|
631
630
|
return [4 /*yield*/, fetchPromise];
|
|
632
631
|
case 4:
|
|
633
|
-
response =
|
|
632
|
+
response = _b.sent();
|
|
634
633
|
return [3 /*break*/, 6];
|
|
635
634
|
case 5:
|
|
636
|
-
originalError_1 =
|
|
637
|
-
errorCode = "fetch-client-network" /* FETCH_NETWORK */;
|
|
638
|
-
if ((
|
|
639
|
-
errorCode = "fetch-timeout" /* FETCH_TIMEOUT */;
|
|
635
|
+
originalError_1 = _b.sent();
|
|
636
|
+
errorCode = "fetch-client-network" /* ErrorCode.FETCH_NETWORK */;
|
|
637
|
+
if ((originalError_1 === null || originalError_1 === void 0 ? void 0 : originalError_1.name) === 'AbortError') {
|
|
638
|
+
errorCode = "fetch-timeout" /* ErrorCode.FETCH_TIMEOUT */;
|
|
640
639
|
}
|
|
641
640
|
throw ERROR_FACTORY.create(errorCode, {
|
|
642
|
-
originalErrorMessage:
|
|
641
|
+
originalErrorMessage: originalError_1 === null || originalError_1 === void 0 ? void 0 : originalError_1.message
|
|
643
642
|
});
|
|
644
643
|
case 6:
|
|
645
644
|
status = response.status;
|
|
646
645
|
responseEtag = response.headers.get('ETag') || undefined;
|
|
647
646
|
if (!(response.status === 200)) return [3 /*break*/, 11];
|
|
648
647
|
responseBody = void 0;
|
|
649
|
-
|
|
648
|
+
_b.label = 7;
|
|
650
649
|
case 7:
|
|
651
|
-
|
|
650
|
+
_b.trys.push([7, 9, , 10]);
|
|
652
651
|
return [4 /*yield*/, response.json()];
|
|
653
652
|
case 8:
|
|
654
|
-
responseBody =
|
|
653
|
+
responseBody = _b.sent();
|
|
655
654
|
return [3 /*break*/, 10];
|
|
656
655
|
case 9:
|
|
657
|
-
originalError_2 =
|
|
658
|
-
throw ERROR_FACTORY.create("fetch-client-parse" /* FETCH_PARSE */, {
|
|
659
|
-
originalErrorMessage:
|
|
656
|
+
originalError_2 = _b.sent();
|
|
657
|
+
throw ERROR_FACTORY.create("fetch-client-parse" /* ErrorCode.FETCH_PARSE */, {
|
|
658
|
+
originalErrorMessage: originalError_2 === null || originalError_2 === void 0 ? void 0 : originalError_2.message
|
|
660
659
|
});
|
|
661
660
|
case 10:
|
|
662
661
|
config = responseBody['entries'];
|
|
663
662
|
state = responseBody['state'];
|
|
664
|
-
|
|
663
|
+
_b.label = 11;
|
|
665
664
|
case 11:
|
|
666
665
|
// Normalizes based on legacy state.
|
|
667
666
|
if (state === 'INSTANCE_STATE_UNSPECIFIED') {
|
|
@@ -679,7 +678,7 @@ var RestClient = /** @class */ (function () {
|
|
|
679
678
|
// differentiating success states (200 from 304; the state body param is undefined in a
|
|
680
679
|
// standard 304).
|
|
681
680
|
if (status !== 304 && status !== 200) {
|
|
682
|
-
throw ERROR_FACTORY.create("fetch-status" /* FETCH_STATUS */, {
|
|
681
|
+
throw ERROR_FACTORY.create("fetch-status" /* ErrorCode.FETCH_STATUS */, {
|
|
683
682
|
httpStatus: status
|
|
684
683
|
});
|
|
685
684
|
}
|
|
@@ -728,7 +727,7 @@ function setAbortableTimeout(signal, throttleEndTimeMillis) {
|
|
|
728
727
|
signal.addEventListener(function () {
|
|
729
728
|
clearTimeout(timeout);
|
|
730
729
|
// If the request completes before this timeout, the rejection has no effect.
|
|
731
|
-
reject(ERROR_FACTORY.create("fetch-throttle" /* FETCH_THROTTLE */, {
|
|
730
|
+
reject(ERROR_FACTORY.create("fetch-throttle" /* ErrorCode.FETCH_THROTTLE */, {
|
|
732
731
|
throttleEndTimeMillis: throttleEndTimeMillis
|
|
733
732
|
}));
|
|
734
733
|
});
|
|
@@ -930,10 +929,9 @@ var RemoteConfig = /** @class */ (function () {
|
|
|
930
929
|
* Converts an error event associated with a {@link IDBRequest} to a {@link FirebaseError}.
|
|
931
930
|
*/
|
|
932
931
|
function toFirebaseError(event, errorCode) {
|
|
933
|
-
var _a;
|
|
934
932
|
var originalError = event.target.error || undefined;
|
|
935
933
|
return ERROR_FACTORY.create(errorCode, {
|
|
936
|
-
originalErrorMessage: originalError && (
|
|
934
|
+
originalErrorMessage: originalError && (originalError === null || originalError === void 0 ? void 0 : originalError.message)
|
|
937
935
|
});
|
|
938
936
|
}
|
|
939
937
|
/**
|
|
@@ -952,11 +950,10 @@ var DB_VERSION = 1;
|
|
|
952
950
|
// Visible for testing.
|
|
953
951
|
function openDatabase() {
|
|
954
952
|
return new Promise(function (resolve, reject) {
|
|
955
|
-
var _a;
|
|
956
953
|
try {
|
|
957
954
|
var request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
958
955
|
request.onerror = function (event) {
|
|
959
|
-
reject(toFirebaseError(event, "storage-open" /* STORAGE_OPEN */));
|
|
956
|
+
reject(toFirebaseError(event, "storage-open" /* ErrorCode.STORAGE_OPEN */));
|
|
960
957
|
};
|
|
961
958
|
request.onsuccess = function (event) {
|
|
962
959
|
resolve(event.target.result);
|
|
@@ -977,8 +974,8 @@ function openDatabase() {
|
|
|
977
974
|
};
|
|
978
975
|
}
|
|
979
976
|
catch (error) {
|
|
980
|
-
reject(ERROR_FACTORY.create("storage-open" /* STORAGE_OPEN */, {
|
|
981
|
-
originalErrorMessage:
|
|
977
|
+
reject(ERROR_FACTORY.create("storage-open" /* ErrorCode.STORAGE_OPEN */, {
|
|
978
|
+
originalErrorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
982
979
|
}));
|
|
983
980
|
}
|
|
984
981
|
});
|
|
@@ -1050,14 +1047,13 @@ var Storage = /** @class */ (function () {
|
|
|
1050
1047
|
case 1:
|
|
1051
1048
|
db = _a.sent();
|
|
1052
1049
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
1053
|
-
var _a;
|
|
1054
1050
|
var transaction = db.transaction([APP_NAMESPACE_STORE], 'readonly');
|
|
1055
1051
|
var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
|
|
1056
1052
|
var compositeKey = _this.createCompositeKey(key);
|
|
1057
1053
|
try {
|
|
1058
1054
|
var request = objectStore.get(compositeKey);
|
|
1059
1055
|
request.onerror = function (event) {
|
|
1060
|
-
reject(toFirebaseError(event, "storage-get" /* STORAGE_GET */));
|
|
1056
|
+
reject(toFirebaseError(event, "storage-get" /* ErrorCode.STORAGE_GET */));
|
|
1061
1057
|
};
|
|
1062
1058
|
request.onsuccess = function (event) {
|
|
1063
1059
|
var result = event.target.result;
|
|
@@ -1070,8 +1066,8 @@ var Storage = /** @class */ (function () {
|
|
|
1070
1066
|
};
|
|
1071
1067
|
}
|
|
1072
1068
|
catch (e) {
|
|
1073
|
-
reject(ERROR_FACTORY.create("storage-get" /* STORAGE_GET */, {
|
|
1074
|
-
originalErrorMessage:
|
|
1069
|
+
reject(ERROR_FACTORY.create("storage-get" /* ErrorCode.STORAGE_GET */, {
|
|
1070
|
+
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
|
1075
1071
|
}));
|
|
1076
1072
|
}
|
|
1077
1073
|
})];
|
|
@@ -1089,7 +1085,6 @@ var Storage = /** @class */ (function () {
|
|
|
1089
1085
|
case 1:
|
|
1090
1086
|
db = _a.sent();
|
|
1091
1087
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
1092
|
-
var _a;
|
|
1093
1088
|
var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');
|
|
1094
1089
|
var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
|
|
1095
1090
|
var compositeKey = _this.createCompositeKey(key);
|
|
@@ -1099,15 +1094,15 @@ var Storage = /** @class */ (function () {
|
|
|
1099
1094
|
value: value
|
|
1100
1095
|
});
|
|
1101
1096
|
request.onerror = function (event) {
|
|
1102
|
-
reject(toFirebaseError(event, "storage-set" /* STORAGE_SET */));
|
|
1097
|
+
reject(toFirebaseError(event, "storage-set" /* ErrorCode.STORAGE_SET */));
|
|
1103
1098
|
};
|
|
1104
1099
|
request.onsuccess = function () {
|
|
1105
1100
|
resolve();
|
|
1106
1101
|
};
|
|
1107
1102
|
}
|
|
1108
1103
|
catch (e) {
|
|
1109
|
-
reject(ERROR_FACTORY.create("storage-set" /* STORAGE_SET */, {
|
|
1110
|
-
originalErrorMessage:
|
|
1104
|
+
reject(ERROR_FACTORY.create("storage-set" /* ErrorCode.STORAGE_SET */, {
|
|
1105
|
+
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
|
1111
1106
|
}));
|
|
1112
1107
|
}
|
|
1113
1108
|
})];
|
|
@@ -1125,22 +1120,21 @@ var Storage = /** @class */ (function () {
|
|
|
1125
1120
|
case 1:
|
|
1126
1121
|
db = _a.sent();
|
|
1127
1122
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
1128
|
-
var _a;
|
|
1129
1123
|
var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');
|
|
1130
1124
|
var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
|
|
1131
1125
|
var compositeKey = _this.createCompositeKey(key);
|
|
1132
1126
|
try {
|
|
1133
1127
|
var request = objectStore.delete(compositeKey);
|
|
1134
1128
|
request.onerror = function (event) {
|
|
1135
|
-
reject(toFirebaseError(event, "storage-delete" /* STORAGE_DELETE */));
|
|
1129
|
+
reject(toFirebaseError(event, "storage-delete" /* ErrorCode.STORAGE_DELETE */));
|
|
1136
1130
|
};
|
|
1137
1131
|
request.onsuccess = function () {
|
|
1138
1132
|
resolve();
|
|
1139
1133
|
};
|
|
1140
1134
|
}
|
|
1141
1135
|
catch (e) {
|
|
1142
|
-
reject(ERROR_FACTORY.create("storage-delete" /* STORAGE_DELETE */, {
|
|
1143
|
-
originalErrorMessage:
|
|
1136
|
+
reject(ERROR_FACTORY.create("storage-delete" /* ErrorCode.STORAGE_DELETE */, {
|
|
1137
|
+
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
|
1144
1138
|
}));
|
|
1145
1139
|
}
|
|
1146
1140
|
})];
|
|
@@ -1261,7 +1255,7 @@ var StorageCache = /** @class */ (function () {
|
|
|
1261
1255
|
* limitations under the License.
|
|
1262
1256
|
*/
|
|
1263
1257
|
function registerRemoteConfig() {
|
|
1264
|
-
_registerComponent(new Component(RC_COMPONENT_NAME, remoteConfigFactory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|
|
1258
|
+
_registerComponent(new Component(RC_COMPONENT_NAME, remoteConfigFactory, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
|
|
1265
1259
|
registerVersion(name, version);
|
|
1266
1260
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
1267
1261
|
registerVersion(name, version, 'esm5');
|
|
@@ -1276,22 +1270,22 @@ function registerRemoteConfig() {
|
|
|
1276
1270
|
.getImmediate();
|
|
1277
1271
|
// Guards against the SDK being used in non-browser environments.
|
|
1278
1272
|
if (typeof window === 'undefined') {
|
|
1279
|
-
throw ERROR_FACTORY.create("registration-window" /* REGISTRATION_WINDOW */);
|
|
1273
|
+
throw ERROR_FACTORY.create("registration-window" /* ErrorCode.REGISTRATION_WINDOW */);
|
|
1280
1274
|
}
|
|
1281
1275
|
// Guards against the SDK being used when indexedDB is not available.
|
|
1282
1276
|
if (!isIndexedDBAvailable()) {
|
|
1283
|
-
throw ERROR_FACTORY.create("indexed-db-unavailable" /* INDEXED_DB_UNAVAILABLE */);
|
|
1277
|
+
throw ERROR_FACTORY.create("indexed-db-unavailable" /* ErrorCode.INDEXED_DB_UNAVAILABLE */);
|
|
1284
1278
|
}
|
|
1285
1279
|
// Normalizes optional inputs.
|
|
1286
1280
|
var _b = app.options, projectId = _b.projectId, apiKey = _b.apiKey, appId = _b.appId;
|
|
1287
1281
|
if (!projectId) {
|
|
1288
|
-
throw ERROR_FACTORY.create("registration-project-id" /* REGISTRATION_PROJECT_ID */);
|
|
1282
|
+
throw ERROR_FACTORY.create("registration-project-id" /* ErrorCode.REGISTRATION_PROJECT_ID */);
|
|
1289
1283
|
}
|
|
1290
1284
|
if (!apiKey) {
|
|
1291
|
-
throw ERROR_FACTORY.create("registration-api-key" /* REGISTRATION_API_KEY */);
|
|
1285
|
+
throw ERROR_FACTORY.create("registration-api-key" /* ErrorCode.REGISTRATION_API_KEY */);
|
|
1292
1286
|
}
|
|
1293
1287
|
if (!appId) {
|
|
1294
|
-
throw ERROR_FACTORY.create("registration-app-id" /* REGISTRATION_APP_ID */);
|
|
1288
|
+
throw ERROR_FACTORY.create("registration-app-id" /* ErrorCode.REGISTRATION_APP_ID */);
|
|
1295
1289
|
}
|
|
1296
1290
|
namespace = namespace || 'firebase';
|
|
1297
1291
|
var storage = new Storage(appId, app.name, namespace);
|