@esfaenza/extensions 11.2.13 → 11.2.17

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.
@@ -1790,8 +1790,20 @@
1790
1790
  * che generi una chiave univoca di sessione su cui tutte le operazioni di questa classe saranno eseguite
1791
1791
  */
1792
1792
  var BaseStorageProvider = /** @class */ (function () {
1793
- function BaseStorageProvider() {
1793
+ /** @ignore Costruttore */
1794
+ function BaseStorageProvider(session) {
1795
+ this.session = session;
1794
1796
  }
1797
+ /**
1798
+ * Ottiene la chiave "Reale" da utilizzare per la persistenza di una chiave generica
1799
+ *
1800
+ * @param {string} key Chiave da storicizzare
1801
+ *
1802
+ * @returns {string} Unione fra l'identificativo della sessione e la chiave specificata
1803
+ */
1804
+ BaseStorageProvider.prototype.getKey = function (key) {
1805
+ return this.session.getSessionKey() + "§" + key + "§";
1806
+ };
1795
1807
  return BaseStorageProvider;
1796
1808
  }());
1797
1809
 
@@ -1826,22 +1838,18 @@
1826
1838
  * @param {string} storeName Chiave del localStorage in cui storicizzare l'oggetto **itemsContainer**
1827
1839
  * @param {{ items: any[] }} itemsContainer Oggetto da storicizzare
1828
1840
  */
1829
- StorageService.prototype.setItem = function (storeName, itemsContainer) {
1830
- //Prima di salvare elimino gli oggetti per non fillare il localStorage di spazzatura
1831
- var item = JSON.parse(JSON.stringify(itemsContainer));
1832
- item.items = [];
1833
- item.savedstate = true;
1834
- item.savedprefix = this.APPSEARCH_PREFIX || 'Hot';
1835
- return this.setAny(storeName, item);
1836
- };
1837
- /**
1838
- * Inserisce un oggetto nello Storage Locale dopo averlo serializzato
1839
- *
1840
- * @param {string} storeName Chiave del localStorage in cui storicizzare l'oggetto **item**
1841
- * @param {any} item Oggetto da storicizzare
1842
- */
1843
- StorageService.prototype.setAny = function (storeName, item) {
1844
- return this._storage.setItem(this._session.getSessionKey(), storeName, item).pipe(operators.tap(function (res) {
1841
+ StorageService.prototype.setItem = function (storeName, item) {
1842
+ var finalItem;
1843
+ //Se sto salvando un oggetto con "items" e "page" vuol dire che è un appsearch, la ripulisco
1844
+ if (item.items && item.page) {
1845
+ finalItem = JSON.parse(JSON.stringify(item));
1846
+ finalItem.items = [];
1847
+ finalItem.savedstate = true;
1848
+ finalItem.savedprefix = this.APPSEARCH_PREFIX || 'Hot';
1849
+ }
1850
+ else
1851
+ finalItem = item;
1852
+ return this._storage.setItem(storeName, finalItem).pipe(operators.tap(function (res) {
1845
1853
  if (res == false) {
1846
1854
  console.error("Impossibile effettuare il salvataggio dell'oggetto all'interno dello Storage Locale per la chiave " + storeName);
1847
1855
  }
@@ -1854,8 +1862,8 @@
1854
1862
  *
1855
1863
  * @returns {any} Oggetto recuperato e deserializzato
1856
1864
  */
1857
- StorageService.prototype.getAny = function (storeName) {
1858
- return this._storage.getItem(this._session.getSessionKey(), storeName).pipe(operators.tap(function (res) {
1865
+ StorageService.prototype.getItem = function (storeName) {
1866
+ return this._storage.getItem(storeName).pipe(operators.tap(function (res) {
1859
1867
  if (res == null)
1860
1868
  console.warn("Impossibile ottenere l'oggetto salvato con chiave " + storeName);
1861
1869
  }));
@@ -1866,7 +1874,7 @@
1866
1874
  * @param {string} storeName Chiave del localStorage da ripulire
1867
1875
  */
1868
1876
  StorageService.prototype.removeItem = function (storeName) {
1869
- return this._storage.removeItem(this._session.getSessionKey(), storeName).pipe(operators.tap(function (res) {
1877
+ return this._storage.removeItem(storeName).pipe(operators.tap(function (res) {
1870
1878
  if (res == false)
1871
1879
  console.warn("Impossibile rimuovere l'oggetto salvato con chiave " + storeName);
1872
1880
  }));
@@ -1877,11 +1885,19 @@
1877
1885
  * @param {string} storeName Chiave del localStorage da ripulire
1878
1886
  */
1879
1887
  StorageService.prototype.clear = function () {
1880
- return this._storage.clear(this._session.getSessionKey()).pipe(operators.tap(function (res) {
1888
+ return this._storage.clear().pipe(operators.tap(function (res) {
1881
1889
  if (res == false)
1882
1890
  console.warn("Impossibile ripulire lo Storage Locale");
1883
1891
  }));
1884
1892
  };
1893
+ /**
1894
+ * Restituisce tutte le chiavi-valore associate alla sessione corrente
1895
+ *
1896
+ * @returns {Observable<{ [index: string]: string; }>} Risultato della query
1897
+ */
1898
+ StorageService.prototype.getAll = function () {
1899
+ return this._storage.getAll();
1900
+ };
1885
1901
  return StorageService;
1886
1902
  }());
1887
1903
  StorageService.decorators = [
@@ -2233,12 +2249,12 @@
2233
2249
  /** Implementazione di default per la classe **BaseStorageProvider** */
2234
2250
  var DefaultStorageProvider = /** @class */ (function (_super) {
2235
2251
  __extends(DefaultStorageProvider, _super);
2236
- /** @ignore Costruttore */
2237
- function DefaultStorageProvider() {
2238
- return _super.call(this) || this;
2252
+ /** @ignore Costruttore */
2253
+ function DefaultStorageProvider(session) {
2254
+ return _super.call(this, session) || this;
2239
2255
  }
2240
2256
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2241
- DefaultStorageProvider.prototype.setItem = function (identity, key, value) {
2257
+ DefaultStorageProvider.prototype.setItem = function (key, value) {
2242
2258
  try {
2243
2259
  localStorage.setItem(key, JSON.stringify(value));
2244
2260
  return rxjs.of(true);
@@ -2263,7 +2279,7 @@
2263
2279
  }
2264
2280
  };
2265
2281
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2266
- DefaultStorageProvider.prototype.getItem = function (identity, key) {
2282
+ DefaultStorageProvider.prototype.getItem = function (key) {
2267
2283
  try {
2268
2284
  var ret = JSON.parse(localStorage.getItem(key));
2269
2285
  return rxjs.of(ret);
@@ -2273,7 +2289,7 @@
2273
2289
  }
2274
2290
  };
2275
2291
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2276
- DefaultStorageProvider.prototype.removeItem = function (identity, key) {
2292
+ DefaultStorageProvider.prototype.removeItem = function (key) {
2277
2293
  try {
2278
2294
  localStorage.removeItem(key);
2279
2295
  return rxjs.of(true);
@@ -2283,7 +2299,7 @@
2283
2299
  }
2284
2300
  };
2285
2301
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2286
- DefaultStorageProvider.prototype.clear = function (identity) {
2302
+ DefaultStorageProvider.prototype.clear = function () {
2287
2303
  try {
2288
2304
  localStorage.clear();
2289
2305
  return rxjs.of(true);
@@ -2292,12 +2308,22 @@
2292
2308
  return rxjs.of(false);
2293
2309
  }
2294
2310
  };
2311
+ /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2312
+ DefaultStorageProvider.prototype.getAll = function () {
2313
+ var ret = {};
2314
+ for (var key in localStorage) {
2315
+ ret[key] = localStorage[key];
2316
+ }
2317
+ return rxjs.of(ret);
2318
+ };
2295
2319
  return DefaultStorageProvider;
2296
2320
  }(BaseStorageProvider));
2297
2321
  DefaultStorageProvider.decorators = [
2298
2322
  { type: core.Injectable }
2299
2323
  ];
2300
- DefaultStorageProvider.ctorParameters = function () { return []; };
2324
+ DefaultStorageProvider.ctorParameters = function () { return [
2325
+ { type: BaseSessionRetriever }
2326
+ ]; };
2301
2327
 
2302
2328
  // Angular
2303
2329
  /**