@ngxs/storage-plugin 3.7.5 → 3.7.6-dev.master-95e4742

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.
Files changed (38) hide show
  1. package/bundles/ngxs-storage-plugin.umd.js +177 -68
  2. package/bundles/ngxs-storage-plugin.umd.js.map +1 -1
  3. package/bundles/ngxs-storage-plugin.umd.min.js +1 -1
  4. package/bundles/ngxs-storage-plugin.umd.min.js.map +1 -1
  5. package/esm2015/index.js +2 -2
  6. package/esm2015/ngxs-storage-plugin.js +4 -3
  7. package/esm2015/src/engines.js +22 -0
  8. package/esm2015/src/internals/final-options.js +42 -0
  9. package/esm2015/src/internals/storage-key.js +47 -0
  10. package/esm2015/src/internals.js +13 -35
  11. package/esm2015/src/public_api.js +2 -1
  12. package/esm2015/src/storage.module.js +9 -3
  13. package/esm2015/src/storage.plugin.js +39 -32
  14. package/esm2015/src/symbols.js +9 -2
  15. package/esm5/index.js +2 -2
  16. package/esm5/ngxs-storage-plugin.js +4 -3
  17. package/esm5/src/engines.js +22 -0
  18. package/esm5/src/internals/final-options.js +43 -0
  19. package/esm5/src/internals/storage-key.js +47 -0
  20. package/esm5/src/internals.js +13 -35
  21. package/esm5/src/public_api.js +2 -1
  22. package/esm5/src/storage.module.js +9 -3
  23. package/esm5/src/storage.plugin.js +43 -35
  24. package/esm5/src/symbols.js +9 -2
  25. package/fesm2015/ngxs-storage-plugin.js +169 -65
  26. package/fesm2015/ngxs-storage-plugin.js.map +1 -1
  27. package/fesm5/ngxs-storage-plugin.js +173 -68
  28. package/fesm5/ngxs-storage-plugin.js.map +1 -1
  29. package/ngxs-storage-plugin.d.ts +2 -1
  30. package/ngxs-storage-plugin.metadata.json +1 -1
  31. package/package.json +4 -4
  32. package/src/engines.d.ts +4 -0
  33. package/src/internals/final-options.d.ts +10 -0
  34. package/src/internals/storage-key.d.ts +17 -0
  35. package/src/internals.d.ts +3 -9
  36. package/src/public_api.d.ts +1 -0
  37. package/src/storage.plugin.d.ts +3 -4
  38. package/src/symbols.d.ts +9 -3
@@ -1,11 +1,10 @@
1
1
  import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store';
2
- import { StorageEngine, NgxsStoragePluginOptions } from './symbols';
2
+ import { FinalNgxsStoragePluginOptions } from './internals/final-options';
3
3
  export declare class NgxsStoragePlugin implements NgxsPlugin {
4
4
  private _options;
5
- private _engine;
6
5
  private _platformId;
7
- private _keys;
6
+ private _keysWithEngines;
8
7
  private _usesDefaultStateKey;
9
- constructor(_options: NgxsStoragePluginOptions, _engine: StorageEngine, _platformId: string);
8
+ constructor(_options: FinalNgxsStoragePluginOptions, _platformId: string);
10
9
  handle(state: any, event: any, next: NgxsNextPluginFn): any;
11
10
  }
package/src/symbols.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InjectionToken } from '@angular/core';
2
- import { StorageKey } from './internals';
2
+ import { StorageKey } from './internals/storage-key';
3
3
  export declare const enum StorageOption {
4
4
  LocalStorage = 0,
5
5
  SessionStorage = 1
@@ -8,7 +8,13 @@ export interface NgxsStoragePluginOptions {
8
8
  /**
9
9
  * Key for the state slice to store in the storage engine.
10
10
  */
11
- key?: undefined | StorageKey;
11
+ key?: undefined | StorageKey | StorageKey[];
12
+ /**
13
+ * The namespace is used to prefix the key for the state slice. This is
14
+ * necessary when running micro frontend applications which use storage plugin.
15
+ * The namespace will eliminate the conflict between keys that might overlap.
16
+ */
17
+ namespace?: string;
12
18
  /**
13
19
  * Storage engine to use. Deaults to localStorage but can provide
14
20
  *
@@ -54,7 +60,7 @@ export interface NgxsStoragePluginOptions {
54
60
  afterDeserialize?(obj: any, key: string): any;
55
61
  }
56
62
  export declare const NGXS_STORAGE_PLUGIN_OPTIONS: InjectionToken<{}>;
57
- export declare const STORAGE_ENGINE: InjectionToken<{}>;
63
+ export declare const STORAGE_ENGINE: InjectionToken<StorageEngine>;
58
64
  export interface StorageEngine {
59
65
  readonly length: number;
60
66
  getItem(key: string): any;