@esfaenza/httpservice 11.2.35 → 11.2.36
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/bundles/esfaenza-httpservice.umd.js +11 -11
- package/bundles/esfaenza-httpservice.umd.js.map +1 -1
- package/bundles/esfaenza-httpservice.umd.min.js +1 -1
- package/bundles/esfaenza-httpservice.umd.min.js.map +1 -1
- package/esm2015/lib/httpservice.service.js +12 -12
- package/fesm2015/esfaenza-httpservice.js +11 -11
- package/fesm2015/esfaenza-httpservice.js.map +1 -1
- package/package.json +2 -2
|
@@ -525,8 +525,8 @@
|
|
|
525
525
|
lsTimed = lsTimed ? JSON.parse(lsTimed) : {};
|
|
526
526
|
lsUntimed = lsUntimed ? JSON.parse(lsUntimed) : {};
|
|
527
527
|
return [4 /*yield*/, rxjs.forkJoin([
|
|
528
|
-
this.localStorage.
|
|
529
|
-
this.localStorage.
|
|
528
|
+
this.localStorage.setItem(this.localStorageHttpTimedCacheKey, lsTimed),
|
|
529
|
+
this.localStorage.setItem(this.localStorageHttpCacheKey, lsUntimed)
|
|
530
530
|
]).toPromise()];
|
|
531
531
|
case 1:
|
|
532
532
|
_e.sent();
|
|
@@ -852,7 +852,7 @@
|
|
|
852
852
|
*/
|
|
853
853
|
HTTPService.prototype.checkCacheInvalidation = function (url) {
|
|
854
854
|
var _this = this;
|
|
855
|
-
var cache = this.localStorage.
|
|
855
|
+
var cache = this.localStorage.getLocalItem(this.localStorageHttpCacheKey);
|
|
856
856
|
var tmp = /#cache(:?-(\d+))/gi.exec(url);
|
|
857
857
|
var cacheTime = tmp ? tmp[2] : null;
|
|
858
858
|
var normalizedUrl = url.replace("#cache" + (cacheTime ? "-" + cacheTime : ""), "").replace(this.BACKEND_URL, "");
|
|
@@ -873,7 +873,7 @@
|
|
|
873
873
|
this.log(this.loc("Invlalidating cache element") + " " + k);
|
|
874
874
|
delete cache[k];
|
|
875
875
|
}
|
|
876
|
-
this.localStorage.
|
|
876
|
+
this.localStorage.setLocalItem(this.localStorageHttpCacheKey, cache);
|
|
877
877
|
};
|
|
878
878
|
/**
|
|
879
879
|
* Finalizzazione di una chiamata
|
|
@@ -906,11 +906,11 @@
|
|
|
906
906
|
tmpKey = "";
|
|
907
907
|
if (this.PersistTimedCacheASAP) {
|
|
908
908
|
tmpKey = this.localStorageHttpTimedCacheKey;
|
|
909
|
-
toCall.push(this.localStorage.
|
|
909
|
+
toCall.push(this.localStorage.setItem(tmpKey, this.localStorage.getLocalItem(tmpKey)));
|
|
910
910
|
}
|
|
911
911
|
if (this.PersistUntimedCacheASAP) {
|
|
912
912
|
tmpKey = this.localStorageHttpCacheKey;
|
|
913
|
-
toCall.push(this.localStorage.
|
|
913
|
+
toCall.push(this.localStorage.setItem(tmpKey, this.localStorage.getLocalItem(tmpKey)));
|
|
914
914
|
}
|
|
915
915
|
this.log(this.loc("No more HTTP calls to be executed, entering idle state and persisting modified caches") + "...");
|
|
916
916
|
return [4 /*yield*/, rxjs.forkJoin(toCall).toPromise()];
|
|
@@ -1143,7 +1143,7 @@
|
|
|
1143
1143
|
this.resetHttpUntimedCacheStorage();
|
|
1144
1144
|
cachingKey = this.makeCacheKey(url, params);
|
|
1145
1145
|
var cacheKey = cacheTime ? this.localStorageHttpTimedCacheKey : this.localStorageHttpCacheKey;
|
|
1146
|
-
var cacheLs = this.localStorage.
|
|
1146
|
+
var cacheLs = this.localStorage.getLocalItem(cacheKey);
|
|
1147
1147
|
var cache_1 = cacheLs ? cacheLs : {};
|
|
1148
1148
|
if (cache_1 && cache_1[cachingKey] && !this.timedCacheItemExpired(cache_1[cachingKey])) {
|
|
1149
1149
|
// Se gestisco il tempo esatto della cache prima di restituire l'oggetto cachato lo ripulisco
|
|
@@ -1163,12 +1163,12 @@
|
|
|
1163
1163
|
*/
|
|
1164
1164
|
HTTPService.prototype.cacheResponse = function (item, cacheInfos) {
|
|
1165
1165
|
var cacheKey = cacheInfos.cacheTime ? this.localStorageHttpTimedCacheKey : this.localStorageHttpCacheKey;
|
|
1166
|
-
var cacheLs = this.localStorage.
|
|
1166
|
+
var cacheLs = this.localStorage.getLocalItem(cacheKey);
|
|
1167
1167
|
var cache = cacheLs ? cacheLs : {};
|
|
1168
1168
|
cache[cacheInfos.cacheKey] = item;
|
|
1169
1169
|
if (cacheInfos.cacheTime)
|
|
1170
1170
|
cache[cacheInfos.cacheKey].__expire = dayjs().add(cacheInfos.cacheTime, "seconds");
|
|
1171
|
-
this.localStorage.
|
|
1171
|
+
this.localStorage.setLocalItem(cacheKey, cache);
|
|
1172
1172
|
};
|
|
1173
1173
|
/**
|
|
1174
1174
|
* Controlla se la cache per le chiamate senza expire time è scaduta
|
|
@@ -1194,14 +1194,14 @@
|
|
|
1194
1194
|
*/
|
|
1195
1195
|
HTTPService.prototype.resetHttpUntimedCacheStorage = function () {
|
|
1196
1196
|
var _a;
|
|
1197
|
-
this.localStorage.
|
|
1197
|
+
this.localStorage.setItem(this.localStorageHttpCacheKey, {}).subscribe();
|
|
1198
1198
|
localStorage.setItem(this.localStorageHttpCacheExpireKey, JSON.stringify(dayjs().add((_a = this.CLIENT_CACHE_DURATION_S) !== null && _a !== void 0 ? _a : 3600, "second")));
|
|
1199
1199
|
};
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Ripulisce la cache delle chiamate con un tempo di expire definito
|
|
1202
1202
|
*/
|
|
1203
1203
|
HTTPService.prototype.resetHttpTimedCacheStorage = function () {
|
|
1204
|
-
this.localStorage.
|
|
1204
|
+
this.localStorage.setItem(this.localStorageHttpTimedCacheKey, {});
|
|
1205
1205
|
};
|
|
1206
1206
|
/**
|
|
1207
1207
|
* Genera una chiave per la cache delle chiamate in base ad URL e Parametri HTTP
|