@esfaenza/extensions 11.2.15 → 11.2.19

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
 
@@ -1807,6 +1819,9 @@
1807
1819
  // Angular
1808
1820
  /**
1809
1821
  * Service che fornisce funzionalità di base per storicizzazione e recupero oggetti dallo Storage Locale
1822
+ *
1823
+ * N.B: In ogni chiamata è presente l'operatore rxjs **first()** per far sì che a prescindere dall'implementazione utente/default gli
1824
+ * observable effettuino l'unsubscribe automaticamente terminata la prima operazine
1810
1825
  */
1811
1826
  var StorageService = /** @class */ (function () {
1812
1827
  /**
@@ -1837,10 +1852,9 @@
1837
1852
  }
1838
1853
  else
1839
1854
  finalItem = item;
1840
- return this._storage.setItem(this._session.getSessionKey(), storeName, finalItem).pipe(operators.tap(function (res) {
1841
- if (res == false) {
1855
+ return this._storage.setItem(storeName, finalItem).pipe(operators.first(), operators.tap(function (res) {
1856
+ if (res == false)
1842
1857
  console.error("Impossibile effettuare il salvataggio dell'oggetto all'interno dello Storage Locale per la chiave " + storeName);
1843
- }
1844
1858
  }));
1845
1859
  };
1846
1860
  /**
@@ -1851,7 +1865,7 @@
1851
1865
  * @returns {any} Oggetto recuperato e deserializzato
1852
1866
  */
1853
1867
  StorageService.prototype.getItem = function (storeName) {
1854
- return this._storage.getItem(this._session.getSessionKey(), storeName).pipe(operators.tap(function (res) {
1868
+ return this._storage.getItem(storeName).pipe(operators.first(), operators.tap(function (res) {
1855
1869
  if (res == null)
1856
1870
  console.warn("Impossibile ottenere l'oggetto salvato con chiave " + storeName);
1857
1871
  }));
@@ -1862,7 +1876,7 @@
1862
1876
  * @param {string} storeName Chiave del localStorage da ripulire
1863
1877
  */
1864
1878
  StorageService.prototype.removeItem = function (storeName) {
1865
- return this._storage.removeItem(this._session.getSessionKey(), storeName).pipe(operators.tap(function (res) {
1879
+ return this._storage.removeItem(storeName).pipe(operators.first(), operators.tap(function (res) {
1866
1880
  if (res == false)
1867
1881
  console.warn("Impossibile rimuovere l'oggetto salvato con chiave " + storeName);
1868
1882
  }));
@@ -1873,11 +1887,19 @@
1873
1887
  * @param {string} storeName Chiave del localStorage da ripulire
1874
1888
  */
1875
1889
  StorageService.prototype.clear = function () {
1876
- return this._storage.clear(this._session.getSessionKey()).pipe(operators.tap(function (res) {
1890
+ return this._storage.clear().pipe(operators.first(), operators.tap(function (res) {
1877
1891
  if (res == false)
1878
1892
  console.warn("Impossibile ripulire lo Storage Locale");
1879
1893
  }));
1880
1894
  };
1895
+ /**
1896
+ * Restituisce tutte le chiavi-valore associate alla sessione corrente
1897
+ *
1898
+ * @returns {Observable<{ [index: string]: string; }>} Risultato della query
1899
+ */
1900
+ StorageService.prototype.getAll = function () {
1901
+ return this._storage.getAll().pipe(operators.first());
1902
+ };
1881
1903
  return StorageService;
1882
1904
  }());
1883
1905
  StorageService.decorators = [
@@ -2229,12 +2251,12 @@
2229
2251
  /** Implementazione di default per la classe **BaseStorageProvider** */
2230
2252
  var DefaultStorageProvider = /** @class */ (function (_super) {
2231
2253
  __extends(DefaultStorageProvider, _super);
2232
- /** @ignore Costruttore */
2233
- function DefaultStorageProvider() {
2234
- return _super.call(this) || this;
2254
+ /** @ignore Costruttore */
2255
+ function DefaultStorageProvider(session) {
2256
+ return _super.call(this, session) || this;
2235
2257
  }
2236
2258
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2237
- DefaultStorageProvider.prototype.setItem = function (identity, key, value) {
2259
+ DefaultStorageProvider.prototype.setItem = function (key, value) {
2238
2260
  try {
2239
2261
  localStorage.setItem(key, JSON.stringify(value));
2240
2262
  return rxjs.of(true);
@@ -2259,7 +2281,7 @@
2259
2281
  }
2260
2282
  };
2261
2283
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2262
- DefaultStorageProvider.prototype.getItem = function (identity, key) {
2284
+ DefaultStorageProvider.prototype.getItem = function (key) {
2263
2285
  try {
2264
2286
  var ret = JSON.parse(localStorage.getItem(key));
2265
2287
  return rxjs.of(ret);
@@ -2269,7 +2291,7 @@
2269
2291
  }
2270
2292
  };
2271
2293
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2272
- DefaultStorageProvider.prototype.removeItem = function (identity, key) {
2294
+ DefaultStorageProvider.prototype.removeItem = function (key) {
2273
2295
  try {
2274
2296
  localStorage.removeItem(key);
2275
2297
  return rxjs.of(true);
@@ -2279,7 +2301,7 @@
2279
2301
  }
2280
2302
  };
2281
2303
  /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2282
- DefaultStorageProvider.prototype.clear = function (identity) {
2304
+ DefaultStorageProvider.prototype.clear = function () {
2283
2305
  try {
2284
2306
  localStorage.clear();
2285
2307
  return rxjs.of(true);
@@ -2288,12 +2310,22 @@
2288
2310
  return rxjs.of(false);
2289
2311
  }
2290
2312
  };
2313
+ /** @ignore Implementazione di Default con localStorage. Identity viene ignorata perché essendo già nel localStorage è già per sito */
2314
+ DefaultStorageProvider.prototype.getAll = function () {
2315
+ var ret = {};
2316
+ for (var key in localStorage) {
2317
+ ret[key] = localStorage[key];
2318
+ }
2319
+ return rxjs.of(ret);
2320
+ };
2291
2321
  return DefaultStorageProvider;
2292
2322
  }(BaseStorageProvider));
2293
2323
  DefaultStorageProvider.decorators = [
2294
2324
  { type: core.Injectable }
2295
2325
  ];
2296
- DefaultStorageProvider.ctorParameters = function () { return []; };
2326
+ DefaultStorageProvider.ctorParameters = function () { return [
2327
+ { type: BaseSessionRetriever }
2328
+ ]; };
2297
2329
 
2298
2330
  // Angular
2299
2331
  /**