@firebase/remote-config
Advanced tools
Comparing version 0.1.7-canary.ba1932f to 0.1.7-canary.ba2ff35
@@ -548,46 +548,39 @@ 'use strict'; | ||
return tslib.__awaiter(this, void 0, void 0, function () { | ||
var abortSignal, e_1, lastFetchStatus; | ||
var _this = this; | ||
return tslib.__generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { return tslib.__awaiter(_this, void 0, void 0, function () { | ||
var abortSignal, e_1, lastFetchStatus; | ||
var _this = this; | ||
return tslib.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () { | ||
return tslib.__generator(this, function (_a) { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
return [2 /*return*/]; | ||
}); | ||
}); }, this.settings.fetchTimeoutMillis); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
return [4 /*yield*/, this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
})]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')]; | ||
case 3: | ||
_a.sent(); | ||
resolve(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
e_1 = _a.sent(); | ||
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)]; | ||
case 5: | ||
_a.sent(); | ||
reject(e_1); | ||
return [3 /*break*/, 6]; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
switch (_a.label) { | ||
case 0: | ||
abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () { | ||
return tslib.__generator(this, function (_a) { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
return [2 /*return*/]; | ||
}); | ||
}); }, this.settings.fetchTimeoutMillis); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
return [4 /*yield*/, this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
})]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')]; | ||
case 3: | ||
_a.sent(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
e_1 = _a.sent(); | ||
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)]; | ||
case 5: | ||
_a.sent(); | ||
throw e_1; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -594,0 +587,0 @@ }); |
@@ -542,46 +542,39 @@ import firebase from '@firebase/app'; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var abortSignal, e_1, lastFetchStatus; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { | ||
var abortSignal, e_1, lastFetchStatus; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
return [2 /*return*/]; | ||
}); | ||
}); }, this.settings.fetchTimeoutMillis); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
return [4 /*yield*/, this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
})]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')]; | ||
case 3: | ||
_a.sent(); | ||
resolve(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
e_1 = _a.sent(); | ||
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)]; | ||
case 5: | ||
_a.sent(); | ||
reject(e_1); | ||
return [3 /*break*/, 6]; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })]; | ||
switch (_a.label) { | ||
case 0: | ||
abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
return [2 /*return*/]; | ||
}); | ||
}); }, this.settings.fetchTimeoutMillis); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
return [4 /*yield*/, this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
})]; | ||
case 2: | ||
_a.sent(); | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')]; | ||
case 3: | ||
_a.sent(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
e_1 = _a.sent(); | ||
lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)]; | ||
case 5: | ||
_a.sent(); | ||
throw e_1; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -588,0 +581,0 @@ }); |
@@ -488,35 +488,32 @@ import firebase from '@firebase/app'; | ||
async fetch() { | ||
return new Promise(async (resolve, reject) => { | ||
// Aborts the request after the given timeout, causing the fetch call to | ||
// reject with an AbortError. | ||
// | ||
// <p>Aborting after the request completes is a no-op, so we don't need a | ||
// corresponding clearTimeout. | ||
// | ||
// Locating abort logic here because: | ||
// * it uses a developer setting (timeout) | ||
// * it applies to all retries (like curl's max-time arg) | ||
// * it is consistent with the Fetch API's signal input | ||
const abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(async () => { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
}, this.settings.fetchTimeoutMillis); | ||
// Catches *all* errors thrown by client so status can be set consistently. | ||
try { | ||
await this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
}); | ||
await this._storageCache.setLastFetchStatus('success'); | ||
resolve(); | ||
} | ||
catch (e) { | ||
const lastFetchStatus = hasErrorCode(e, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
await this._storageCache.setLastFetchStatus(lastFetchStatus); | ||
reject(e); | ||
} | ||
}); | ||
// Aborts the request after the given timeout, causing the fetch call to | ||
// reject with an AbortError. | ||
// | ||
// <p>Aborting after the request completes is a no-op, so we don't need a | ||
// corresponding clearTimeout. | ||
// | ||
// Locating abort logic here because: | ||
// * it uses a developer setting (timeout) | ||
// * it applies to all retries (like curl's max-time arg) | ||
// * it is consistent with the Fetch API's signal input | ||
const abortSignal = new RemoteConfigAbortSignal(); | ||
setTimeout(async () => { | ||
// Note a very low delay, eg < 10ms, can elapse before listeners are initialized. | ||
abortSignal.abort(); | ||
}, this.settings.fetchTimeoutMillis); | ||
// Catches *all* errors thrown by client so status can be set consistently. | ||
try { | ||
await this._client.fetch({ | ||
cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis, | ||
signal: abortSignal | ||
}); | ||
await this._storageCache.setLastFetchStatus('success'); | ||
} | ||
catch (e) { | ||
const lastFetchStatus = hasErrorCode(e, "fetch-throttle" /* FETCH_THROTTLE */) | ||
? 'throttle' | ||
: 'failure'; | ||
await this._storageCache.setLastFetchStatus(lastFetchStatus); | ||
throw e; | ||
} | ||
} | ||
@@ -523,0 +520,0 @@ async fetchAndActivate() { |
{ | ||
"name": "@firebase/remote-config", | ||
"version": "0.1.7-canary.ba1932f", | ||
"version": "0.1.7-canary.ba2ff35", | ||
"description": "The Remote Config package of the Firebase JS SDK", | ||
@@ -25,10 +25,10 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"peerDependencies": { | ||
"@firebase/app": "0.4.25-canary.ba1932f", | ||
"@firebase/app-types": "0.4.8-canary.ba1932f" | ||
"@firebase/app": "0.4.25-canary.ba2ff35", | ||
"@firebase/app-types": "0.4.8-canary.ba2ff35" | ||
}, | ||
"dependencies": { | ||
"@firebase/installations": "0.3.6-canary.ba1932f", | ||
"@firebase/logger": "0.1.31-canary.ba1932f", | ||
"@firebase/remote-config-types": "0.1.3-canary.ba1932f", | ||
"@firebase/util": "0.2.34-canary.ba1932f", | ||
"@firebase/installations": "0.3.6-canary.ba2ff35", | ||
"@firebase/logger": "0.1.31-canary.ba2ff35", | ||
"@firebase/remote-config-types": "0.1.3-canary.ba2ff35", | ||
"@firebase/util": "0.2.34-canary.ba2ff35", | ||
"tslib": "1.10.0" | ||
@@ -35,0 +35,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
412300
4283
+ Added@firebase/app@0.4.25-canary.ba2ff35(transitive)
+ Added@firebase/app-types@0.4.8-canary.ba2ff35(transitive)
+ Added@firebase/installations@0.3.6-canary.ba2ff35(transitive)
+ Added@firebase/installations-types@0.2.2-canary.ba2ff35(transitive)
+ Added@firebase/logger@0.1.31-canary.ba2ff35(transitive)
+ Added@firebase/remote-config-types@0.1.3-canary.ba2ff35(transitive)
+ Added@firebase/util@0.2.34-canary.ba2ff35(transitive)
- Removed@firebase/app@0.4.25-canary.ba1932f(transitive)
- Removed@firebase/app-types@0.4.8-canary.ba1932f(transitive)
- Removed@firebase/installations@0.3.6-canary.ba1932f(transitive)
- Removed@firebase/installations-types@0.2.2-canary.ba1932f(transitive)
- Removed@firebase/logger@0.1.31-canary.ba1932f(transitive)
- Removed@firebase/remote-config-types@0.1.3-canary.ba1932f(transitive)
- Removed@firebase/util@0.2.34-canary.ba1932f(transitive)