@ngx-pwa/local-storage 13.0.6 → 14.0.0

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.
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, InjectionToken, Inject, PLATFORM_ID, NgModule } from '@angular/core';
2
+ import { Injectable, InjectionToken, inject, Inject, PLATFORM_ID, NgModule, makeEnvironmentProviders } from '@angular/core';
3
3
  import { isPlatformBrowser } from '@angular/common';
4
4
  import { ReplaySubject, fromEvent, race, throwError, of, Observable, asyncScheduler, from } from 'rxjs';
5
- import { mergeMap, map, first, mapTo, takeWhile, tap, observeOn, catchError } from 'rxjs/operators';
5
+ import { mergeMap, map, first, takeWhile, tap, observeOn, catchError } from 'rxjs/operators';
6
6
 
7
7
  class JSONValidator {
8
8
  /**
@@ -236,9 +236,9 @@ class JSONValidator {
236
236
  return (schema.enum.includes(data));
237
237
  }
238
238
  }
239
- JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
240
- JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, providedIn: 'root' });
241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: JSONValidator, decorators: [{
239
+ JSONValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: JSONValidator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
240
+ JSONValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: JSONValidator, providedIn: 'root' });
241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: JSONValidator, decorators: [{
242
242
  type: Injectable,
243
243
  args: [{
244
244
  providedIn: 'root'
@@ -332,14 +332,7 @@ class SerializationError extends Error {
332
332
  }
333
333
 
334
334
  class IndexedDBDatabase {
335
- /**
336
- * Constructor params are provided by Angular (but can also be passed manually in tests)
337
- * @param dbName `indexedDB` database name
338
- * @param storeName `indexedDB` store name
339
- * @param dbVersion `indexedDB` database version
340
- * @param noWrap Flag to not wrap `indexedDB` values for interoperability or to wrap for backward compatibility
341
- */
342
- constructor(dbName = DEFAULT_IDB_DB_NAME, storeName = DEFAULT_IDB_STORE_NAME, dbVersion = DEFAULT_IDB_DB_VERSION, noWrap = DEFAULT_IDB_NO_WRAP) {
335
+ constructor() {
343
336
  /**
344
337
  * `indexedDB` database connection, wrapped in a RxJS `ReplaySubject` to be able to access the connection
345
338
  * even after the connection success event happened
@@ -349,10 +342,10 @@ class IndexedDBDatabase {
349
342
  * Index used when wrapping value. *For backward compatibility only.*
350
343
  */
351
344
  this.wrapIndex = 'value';
352
- this.dbName = dbName;
353
- this.storeName = storeName;
354
- this.dbVersion = dbVersion;
355
- this.noWrap = noWrap;
345
+ this.dbName = inject(IDB_DB_NAME);
346
+ this.storeName = inject(IDB_STORE_NAME);
347
+ this.dbVersion = inject(IDB_DB_VERSION);
348
+ this.noWrap = inject(IDB_NO_WRAP);
356
349
  /* Connect to `indexedDB`, with prefix if provided by the user */
357
350
  this.connect();
358
351
  }
@@ -434,8 +427,7 @@ class IndexedDBDatabase {
434
427
  /* Add if the item is not existing yet, or update otherwise */
435
428
  store.put(dataToStore, key);
436
429
  /* Listen to events and return `undefined` as no value is expected */
437
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
438
- return events.pipe(mapTo(undefined));
430
+ return events.pipe(map(() => undefined));
439
431
  }),
440
432
  /* The observable will complete after the first value */
441
433
  first());
@@ -452,8 +444,7 @@ class IndexedDBDatabase {
452
444
  /* Delete the item in store */
453
445
  store.delete(key);
454
446
  /* Listen to events and return `undefined` as no data is expected here */
455
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
456
- return events.pipe(mapTo(undefined));
447
+ return events.pipe(map(() => undefined));
457
448
  }),
458
449
  /* The observable will complete after the first value */
459
450
  first());
@@ -469,8 +460,7 @@ class IndexedDBDatabase {
469
460
  /* Delete all items in object store */
470
461
  store.clear();
471
462
  /* Listen to events and return `undefined` as no data is expected here */
472
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
473
- return events.pipe(mapTo(undefined));
463
+ return events.pipe(map(() => undefined));
474
464
  }),
475
465
  /* The observable will complete */
476
466
  first());
@@ -595,7 +585,7 @@ class IndexedDBDatabase {
595
585
  }
596
586
  catch (error) {
597
587
  /* The store could have been deleted from outside */
598
- return throwError(error);
588
+ return throwError(() => error);
599
589
  }
600
590
  /* Get the store from the transaction */
601
591
  const store = transaction.objectStore(this.storeName);
@@ -614,7 +604,7 @@ class IndexedDBDatabase {
614
604
  /* Throw on error to be able to catch errors in RxJS way.
615
605
  * Here `event.target` must be used, as `transactionOrRequest.error` will be `null`
616
606
  * if we are on the request and the error is only triggered later by the transaction */
617
- mergeMap((event) => throwError(event.target.error)));
607
+ mergeMap((event) => throwError(() => event.target.error)));
618
608
  }
619
609
  /**
620
610
  * Listen transaction `complete` and `error` events
@@ -630,34 +620,17 @@ class IndexedDBDatabase {
630
620
  return race([complete$, error$]);
631
621
  }
632
622
  }
633
- IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, deps: [{ token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }], target: i0.ɵɵFactoryTarget.Injectable });
634
- IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, providedIn: 'root' });
635
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: IndexedDBDatabase, decorators: [{
623
+ IndexedDBDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IndexedDBDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
624
+ IndexedDBDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IndexedDBDatabase, providedIn: 'root' });
625
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IndexedDBDatabase, decorators: [{
636
626
  type: Injectable,
637
627
  args: [{
638
628
  providedIn: 'root'
639
629
  }]
640
- }], ctorParameters: function () {
641
- return [{ type: undefined, decorators: [{
642
- type: Inject,
643
- args: [IDB_DB_NAME]
644
- }] }, { type: undefined, decorators: [{
645
- type: Inject,
646
- args: [IDB_STORE_NAME]
647
- }] }, { type: undefined, decorators: [{
648
- type: Inject,
649
- args: [IDB_DB_VERSION]
650
- }] }, { type: undefined, decorators: [{
651
- type: Inject,
652
- args: [IDB_NO_WRAP]
653
- }] }];
654
- } });
630
+ }], ctorParameters: function () { return []; } });
655
631
 
656
632
  class LocalStorageDatabase {
657
- /**
658
- * Constructor params are provided by Angular (but can also be passed manually in tests)
659
- * @param prefix Prefix option to avoid collision for multiple apps on the same subdomain or for interoperability
660
- */
633
+ // `inject()` cannot be used here, as `LocalStorageDatabase` is instanciated at runtime in some scenarios
661
634
  constructor(prefix = '') {
662
635
  /* Prefix if asked, or no prefix otherwise */
663
636
  this.prefix = prefix || '';
@@ -685,7 +658,7 @@ class LocalStorageDatabase {
685
658
  parsedData = JSON.parse(unparsedData);
686
659
  }
687
660
  catch (error) {
688
- return throwError(error);
661
+ return throwError(() => error);
689
662
  }
690
663
  }
691
664
  /* Wrap in a RxJS `Observable` to be consistent with other storages */
@@ -703,21 +676,21 @@ class LocalStorageDatabase {
703
676
  const dataPrototype = Object.getPrototypeOf(data);
704
677
  if ((typeof data === 'object') && (data !== null) && !Array.isArray(data) &&
705
678
  !((dataPrototype === Object.prototype) || (dataPrototype === null))) {
706
- return throwError(new SerializationError());
679
+ return throwError(() => new SerializationError());
707
680
  }
708
681
  /* Try to stringify (can fail on circular references) */
709
682
  try {
710
683
  serializedData = JSON.stringify(data);
711
684
  }
712
685
  catch (error) {
713
- return throwError(error);
686
+ return throwError(() => error);
714
687
  }
715
688
  /* Can fail if storage quota is exceeded */
716
689
  try {
717
690
  localStorage.setItem(this.prefixKey(key), serializedData);
718
691
  }
719
692
  catch (error) {
720
- return throwError(error);
693
+ return throwError(() => error);
721
694
  }
722
695
  /* Wrap in a RxJS `Observable` to be consistent with other storages */
723
696
  return of(undefined);
@@ -798,9 +771,9 @@ class LocalStorageDatabase {
798
771
  return `${this.prefix}${key}`;
799
772
  }
800
773
  }
801
- LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, deps: [{ token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
802
- LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, providedIn: 'root' });
803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorageDatabase, decorators: [{
774
+ LocalStorageDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorageDatabase, deps: [{ token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
775
+ LocalStorageDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorageDatabase, providedIn: 'root' });
776
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorageDatabase, decorators: [{
804
777
  type: Injectable,
805
778
  args: [{
806
779
  providedIn: 'root'
@@ -883,9 +856,9 @@ class MemoryDatabase {
883
856
  return of(this.memoryStorage.has(key));
884
857
  }
885
858
  }
886
- MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
887
- MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, providedIn: 'root' });
888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: MemoryDatabase, decorators: [{
859
+ MemoryDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MemoryDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
860
+ MemoryDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MemoryDatabase, providedIn: 'root' });
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MemoryDatabase, decorators: [{
889
862
  type: Injectable,
890
863
  args: [{
891
864
  providedIn: 'root'
@@ -894,13 +867,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
894
867
 
895
868
  /**
896
869
  * Factory to create a storage according to browser support
897
- * @param platformId Context about the platform (`browser`, `server`...)
898
- * @param LSPrefix Prefix for `localStorage` keys to avoid collision for multiple apps on the same subdomain
899
- * @param IDBDBName `indexedDB` database name
900
- * @param IDBstoreName `indexedDB` storeName name
901
870
  * @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/blob/main/docs/BROWSERS_SUPPORT.md}
902
871
  */
903
- function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap) {
872
+ function localDatabaseFactory() {
873
+ const platformId = inject(PLATFORM_ID);
904
874
  /* When storage is fully disabled in browser (via the "Block all cookies" option),
905
875
  * just trying to check `indexedDB` or `localStorage` variables causes a security exception.
906
876
  * Prevents https://github.com/cyrilletuzi/angular-async-local-storage/issues/118
@@ -915,7 +885,7 @@ function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDB
915
885
  * Will be the case for:
916
886
  * - All other browsers in normal mode
917
887
  * - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */
918
- return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap);
888
+ return new IndexedDBDatabase();
919
889
  }
920
890
  else if (isPlatformBrowser(platformId)
921
891
  && (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) {
@@ -930,7 +900,7 @@ function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDB
930
900
  * For Firefox, can only be detected later in `IndexedDBDatabase.connect()`
931
901
  * @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982}
932
902
  */
933
- return new LocalStorageDatabase(LSPrefix);
903
+ return new LocalStorageDatabase();
934
904
  }
935
905
  }
936
906
  catch (_a) {
@@ -945,21 +915,13 @@ function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDB
945
915
  }
946
916
  class LocalDatabase {
947
917
  }
948
- LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
949
- LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, providedIn: 'root', useFactory: localDatabaseFactory, deps: [{ token: PLATFORM_ID }, { token: LS_PREFIX }, { token: IDB_DB_NAME }, { token: IDB_STORE_NAME }, { token: IDB_DB_VERSION }, { token: IDB_NO_WRAP }] });
950
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalDatabase, decorators: [{
918
+ LocalDatabase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalDatabase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
919
+ LocalDatabase.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalDatabase, providedIn: 'root', useFactory: localDatabaseFactory });
920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalDatabase, decorators: [{
951
921
  type: Injectable,
952
922
  args: [{
953
923
  providedIn: 'root',
954
924
  useFactory: localDatabaseFactory,
955
- deps: [
956
- PLATFORM_ID,
957
- LS_PREFIX,
958
- IDB_DB_NAME,
959
- IDB_STORE_NAME,
960
- IDB_DB_VERSION,
961
- IDB_NO_WRAP,
962
- ]
963
925
  }]
964
926
  }] });
965
927
 
@@ -985,7 +947,9 @@ class StorageMap {
985
947
  * @param jsonValidator Validator service
986
948
  * @param LSPrefix Prefix for `localStorage` keys to avoid collision for multiple apps on the same subdomain or for interoperability
987
949
  */
988
- constructor(database, jsonValidator = new JSONValidator(), LSPrefix = '') {
950
+ constructor(database, jsonValidator = new JSONValidator(),
951
+ // `inject()` cannot be used here, as `StorageMap` needs other manual params
952
+ LSPrefix = '') {
989
953
  this.database = database;
990
954
  this.jsonValidator = jsonValidator;
991
955
  this.LSPrefix = LSPrefix;
@@ -1080,7 +1044,7 @@ class StorageMap {
1080
1044
  else if (schema) {
1081
1045
  /* Validate data against a JSON schema if provided */
1082
1046
  if (!this.jsonValidator.validate(data, schema)) {
1083
- return throwError(new ValidationError());
1047
+ return throwError(() => new ValidationError());
1084
1048
  }
1085
1049
  /* Data have been checked, so it's OK to cast */
1086
1050
  return of(data);
@@ -1108,7 +1072,7 @@ class StorageMap {
1108
1072
  }
1109
1073
  /* Validate data against a JSON schema if provided */
1110
1074
  if (schema && !this.jsonValidator.validate(data, schema)) {
1111
- return throwError(new ValidationError());
1075
+ return throwError(() => new ValidationError());
1112
1076
  }
1113
1077
  return this.database.set(key, data).pipe(
1114
1078
  /* Catch if `indexedDb` is broken */
@@ -1244,14 +1208,15 @@ class StorageMap {
1244
1208
  }
1245
1209
  else {
1246
1210
  /* Otherwise, rethrow the error */
1247
- return throwError(error);
1211
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
1212
+ return throwError(() => error);
1248
1213
  }
1249
1214
  });
1250
1215
  }
1251
1216
  }
1252
- StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, deps: [{ token: LocalDatabase }, { token: JSONValidator }, { token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
1253
- StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, providedIn: 'root' });
1254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageMap, decorators: [{
1217
+ StorageMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageMap, deps: [{ token: LocalDatabase }, { token: JSONValidator }, { token: LS_PREFIX }], target: i0.ɵɵFactoryTarget.Injectable });
1218
+ StorageMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageMap, providedIn: 'root' });
1219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageMap, decorators: [{
1255
1220
  type: Injectable,
1256
1221
  args: [{
1257
1222
  providedIn: 'root'
@@ -1302,8 +1267,7 @@ class LocalStorage {
1302
1267
  setItem(key, data, schema) {
1303
1268
  return this.storageMap.set(key, data, schema).pipe(
1304
1269
  /* Transform `undefined` into `true` for backward compatibility with v7 */
1305
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1306
- mapTo(true));
1270
+ map(() => true));
1307
1271
  }
1308
1272
  /**
1309
1273
  * Delete an item in storage
@@ -1316,8 +1280,7 @@ class LocalStorage {
1316
1280
  removeItem(key) {
1317
1281
  return this.storageMap.delete(key).pipe(
1318
1282
  /* Transform `undefined` into `true` for backward compatibility with v7 */
1319
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1320
- mapTo(true));
1283
+ map(() => true));
1321
1284
  }
1322
1285
  /**
1323
1286
  * Delete all items in storage
@@ -1329,13 +1292,12 @@ class LocalStorage {
1329
1292
  clear() {
1330
1293
  return this.storageMap.clear().pipe(
1331
1294
  /* Transform `undefined` into `true` for backward compatibility with v7 */
1332
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1333
- mapTo(true));
1295
+ map(() => true));
1334
1296
  }
1335
1297
  }
1336
- LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, deps: [{ token: StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
1337
- LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, providedIn: 'root' });
1338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: LocalStorage, decorators: [{
1298
+ LocalStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorage, deps: [{ token: StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
1299
+ LocalStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorage, providedIn: 'root' });
1300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: LocalStorage, decorators: [{
1339
1301
  type: Injectable,
1340
1302
  args: [{
1341
1303
  providedIn: 'root'
@@ -1371,13 +1333,92 @@ class StorageModule {
1371
1333
  };
1372
1334
  }
1373
1335
  }
1374
- StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1375
- StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
1376
- StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule });
1377
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: StorageModule, decorators: [{
1336
+ StorageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1337
+ StorageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: StorageModule });
1338
+ StorageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageModule });
1339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: StorageModule, decorators: [{
1378
1340
  type: NgModule
1379
1341
  }] });
1380
1342
 
1343
+ /**
1344
+ * Allows to add a prefix before `localStorage` keys.
1345
+ * *Use only* for interoperability with other APIs or to avoid collision for multiple apps on the same subdomain.
1346
+ * **WARNING: do not change this option in an app already deployed in production, as previously stored data would be lost.**
1347
+ *
1348
+ * @example
1349
+ * bootstrapApplication(AppComponent, {
1350
+ * providers: [provideLocalStoragePrefix('custom_')]
1351
+ * });
1352
+ *
1353
+ * @example
1354
+ * NgModule({
1355
+ * providers: [provideLocalStoragePrefix('custom_')]
1356
+ * })
1357
+ * export class AppModule
1358
+ */
1359
+ function provideLocalStoragePrefix(prefix) {
1360
+ return makeEnvironmentProviders([{ provide: LS_PREFIX, useValue: prefix }]);
1361
+ }
1362
+ /**
1363
+ * Allows to change the name used for `indexedDB` database.
1364
+ * *Use only* for interoperability with other APIs or to avoid collision for multiple apps on the same subdomain.
1365
+ * **WARNING: do not change this option in an app already deployed in production, as previously stored data would be lost.**
1366
+ *
1367
+ * @example
1368
+ * bootstrapApplication(AppComponent, {
1369
+ * providers: [provideIndexedDBDataBaseName('custom')]
1370
+ * });
1371
+ *
1372
+ * @example
1373
+ * NgModule({
1374
+ * providers: [provideIndexedDBDataBaseName('custom')]
1375
+ * })
1376
+ * export class AppModule
1377
+ */
1378
+ function provideIndexedDBDataBaseName(name) {
1379
+ return makeEnvironmentProviders([{ provide: IDB_DB_NAME, useValue: name }]);
1380
+ }
1381
+ /**
1382
+ * Allows to change the database version used for `indexedDB` database.
1383
+ * Must be an unsigned **integer**.
1384
+ * **Use with caution as the creation of the store depends on the version.**
1385
+ * *Use only* for interoperability with other APIs or to avoid collision for multiple apps on the same subdomain.
1386
+ * **WARNING: do not change this option in an app already deployed in production, as previously stored data would be lost.**
1387
+ *
1388
+ * @example
1389
+ * bootstrapApplication(AppComponent, {
1390
+ * providers: [provideIndexedDBDataBaseVersion(2)]
1391
+ * });
1392
+ *
1393
+ * @example
1394
+ * NgModule({
1395
+ * providers: [provideIndexedDBDataBaseVersion(2)]
1396
+ * })
1397
+ * export class AppModule
1398
+ */
1399
+ function provideIndexedDBDataBaseVersion(version) {
1400
+ return makeEnvironmentProviders([{ provide: IDB_DB_VERSION, useValue: version }]);
1401
+ }
1402
+ /**
1403
+ * Allows to change the name used for `indexedDB` object store.
1404
+ * *Use only* for interoperability with other APIs.
1405
+ * **WARNING: do not change this option in an app already deployed in production, as previously stored data would be lost.**
1406
+ *
1407
+ * @example
1408
+ * bootstrapApplication(AppComponent, {
1409
+ * providers: [provideIndexedDBStoreName('custom')]
1410
+ * });
1411
+ *
1412
+ * @example
1413
+ * NgModule({
1414
+ * providers: [provideIndexedDBStoreName('custom')]
1415
+ * })
1416
+ * export class AppModule
1417
+ */
1418
+ function provideIndexedDBStoreName(name) {
1419
+ return makeEnvironmentProviders([{ provide: IDB_STORE_NAME, useValue: name }]);
1420
+ }
1421
+
1381
1422
  /*
1382
1423
  * Public API Surface of local-storage
1383
1424
  */
@@ -1386,5 +1427,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImpor
1386
1427
  * Generated bundle index. Do not edit.
1387
1428
  */
1388
1429
 
1389
- export { JSONValidator, LocalDatabase, LocalStorage, SERIALIZATION_ERROR, SerializationError, StorageMap, StorageModule, VALIDATION_ERROR, ValidationError };
1430
+ export { JSONValidator, LocalDatabase, LocalStorage, SERIALIZATION_ERROR, SerializationError, StorageMap, StorageModule, VALIDATION_ERROR, ValidationError, provideIndexedDBDataBaseName, provideIndexedDBDataBaseVersion, provideIndexedDBStoreName, provideLocalStoragePrefix };
1431
+ //# sourceMappingURL=ngx-pwa-local-storage.mjs.map
1390
1432
  //# sourceMappingURL=ngx-pwa-local-storage.mjs.map