@esfaenza/httpservice 11.2.40 → 11.2.43
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 +16 -13
- package/bundles/esfaenza-httpservice.umd.js.map +1 -1
- package/bundles/esfaenza-httpservice.umd.min.js +2 -2
- package/bundles/esfaenza-httpservice.umd.min.js.map +1 -1
- package/esfaenza-httpservice.metadata.json +1 -1
- package/esm2015/lib/httpservice.service.js +10 -6
- package/fesm2015/esfaenza-httpservice.js +9 -5
- package/fesm2015/esfaenza-httpservice.js.map +1 -1
- package/lib/httpservice.service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@esfaenza/preferences'), require('rxjs/operators'), require('rxjs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@esfaenza/httpservice', ['exports', '@angular/common/http', '@angular/core', '@esfaenza/preferences', 'rxjs/operators', 'rxjs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza.httpservice = {}), global.ng.common.http, global.ng.core, global.preferences, global.rxjs.operators, global.rxjs));
|
|
5
|
-
})(this, (function (exports, http, core, preferences, operators, rxjs) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@esfaenza/preferences'), require('@esfaenza/extensions'), require('rxjs/operators'), require('rxjs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@esfaenza/httpservice', ['exports', '@angular/common/http', '@angular/core', '@esfaenza/preferences', '@esfaenza/extensions', 'rxjs/operators', 'rxjs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza.httpservice = {}), global.ng.common.http, global.ng.core, global.preferences, global.extensions, global.rxjs.operators, global.rxjs));
|
|
5
|
+
})(this, (function (exports, http, core, preferences, extensions, operators, rxjs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
/**
|
|
472
472
|
* @ignore
|
|
473
473
|
*/
|
|
474
|
-
function HTTPService(BACKEND_URL, EXTENSION_CLASS, HTTP_INVALIDATION, LOCALE, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, http, localStorage) {
|
|
474
|
+
function HTTPService(BACKEND_URL, EXTENSION_CLASS, HTTP_INVALIDATION, LOCALE, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, http, localStorage, utisExts) {
|
|
475
475
|
var _a, _b;
|
|
476
476
|
this.BACKEND_URL = BACKEND_URL;
|
|
477
477
|
this.EXTENSION_CLASS = EXTENSION_CLASS;
|
|
@@ -483,6 +483,7 @@
|
|
|
483
483
|
this.DEBUG_MODE = DEBUG_MODE;
|
|
484
484
|
this.http = http;
|
|
485
485
|
this.localStorage = localStorage;
|
|
486
|
+
this.utisExts = utisExts;
|
|
486
487
|
/** Cache dello stato delle chiamate HTTP attualmente effettuate. Ogni chiamata è rappresentata da un GUID e lo status assume valore **false** solo sugli errori */
|
|
487
488
|
this.callStatus = {};
|
|
488
489
|
/** Nome della cache in cui vengono storicizzate le informazioni sulle risposte delle chiamate sotto forma di dictionary */
|
|
@@ -566,7 +567,7 @@
|
|
|
566
567
|
return httpCall.pipe(operators.map(function (res) {
|
|
567
568
|
var responseItem = res;
|
|
568
569
|
if (cachedInfos.cache) {
|
|
569
|
-
_this.cacheResponse(responseItem, cachedInfos);
|
|
570
|
+
_this.cacheResponse(_this.utisExts.deepClone(responseItem), cachedInfos);
|
|
570
571
|
_this.log(_this.loc("Cached result for") + " " + url);
|
|
571
572
|
}
|
|
572
573
|
return responseItem;
|
|
@@ -1140,7 +1141,7 @@
|
|
|
1140
1141
|
* @returns {CacheInfos} Oggetto contenente le informazioni sulla cache per l'oggetto specificato
|
|
1141
1142
|
*/
|
|
1142
1143
|
HTTPService.prototype.tryGetCacheInformations = function (url, params) {
|
|
1143
|
-
var cachingKey = null, cacheTime = null,
|
|
1144
|
+
var cachingKey = null, cacheTime = null, item = null;
|
|
1144
1145
|
var useCaching = !!(/#cache/gi.exec(url));
|
|
1145
1146
|
if (useCaching) {
|
|
1146
1147
|
var tmp = /#cache(:?-(\d+))/gi.exec(url);
|
|
@@ -1151,16 +1152,17 @@
|
|
|
1151
1152
|
cachingKey = this.makeCacheKey(url, params);
|
|
1152
1153
|
var cacheKey = cacheTime ? this.localStorageHttpTimedCacheKey : this.localStorageHttpCacheKey;
|
|
1153
1154
|
var cacheLs = this.localStorage.getLocalItem(cacheKey);
|
|
1154
|
-
var
|
|
1155
|
-
if (
|
|
1155
|
+
var cache = cacheLs ? cacheLs : {};
|
|
1156
|
+
if (cache && cache[cachingKey] && !this.timedCacheItemExpired(cache[cachingKey])) {
|
|
1156
1157
|
// Se gestisco il tempo esatto della cache prima di restituire l'oggetto cachato lo ripulisco
|
|
1157
1158
|
// dalle proprietà interne che gli ho aggiunto per controllarne la scadenza
|
|
1158
1159
|
if (cacheTime)
|
|
1159
|
-
delete
|
|
1160
|
-
item =
|
|
1160
|
+
delete cache[cachingKey].__expire;
|
|
1161
|
+
item = cache[cachingKey];
|
|
1161
1162
|
}
|
|
1162
1163
|
}
|
|
1163
|
-
|
|
1164
|
+
// Per assicurarmi che il rifeirmento degli oggetti sia diverso utilizzo il deepClone
|
|
1165
|
+
return new CacheInfos(url, useCaching, cachingKey, cacheTime, this.utisExts.deepClone(item));
|
|
1164
1166
|
};
|
|
1165
1167
|
/**
|
|
1166
1168
|
* Inserisce un oggetto nella cache appropriata in base alle informazioni contenute nel parametro **cacheInfos**
|
|
@@ -1290,7 +1292,8 @@
|
|
|
1290
1292
|
{ type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [CACHE_BY_USER,] }] },
|
|
1291
1293
|
{ type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DEBUG_MODE,] }] },
|
|
1292
1294
|
{ type: http.HttpClient },
|
|
1293
|
-
{ type: preferences.PreferencesService }
|
|
1295
|
+
{ type: preferences.PreferencesService },
|
|
1296
|
+
{ type: extensions.UtilityService }
|
|
1294
1297
|
]; };
|
|
1295
1298
|
|
|
1296
1299
|
var HttpserviceModule = /** @class */ (function () {
|