@ngxs/storage-plugin 3.7.6 → 3.8.0-dev.master-743a236

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 (36) hide show
  1. package/bundles/ngxs-storage-plugin.umd.js +467 -499
  2. package/bundles/ngxs-storage-plugin.umd.js.map +1 -1
  3. package/esm2015/index.js +2 -6
  4. package/esm2015/ngxs-storage-plugin.js +2 -8
  5. package/esm2015/src/engines.js +10 -0
  6. package/esm2015/src/internals/final-options.js +16 -0
  7. package/esm2015/src/internals/storage-key.js +21 -0
  8. package/esm2015/src/internals.js +9 -58
  9. package/esm2015/src/public_api.js +3 -6
  10. package/esm2015/src/storage.module.js +16 -15
  11. package/esm2015/src/storage.plugin.js +41 -109
  12. package/esm2015/src/symbols.js +2 -91
  13. package/fesm2015/ngxs-storage-plugin.js +103 -273
  14. package/fesm2015/ngxs-storage-plugin.js.map +1 -1
  15. package/ngxs-storage-plugin.d.ts +1 -2
  16. package/package.json +5 -8
  17. package/src/engines.d.ts +4 -0
  18. package/src/internals/final-options.d.ts +10 -0
  19. package/src/internals/storage-key.d.ts +17 -0
  20. package/src/internals.d.ts +3 -9
  21. package/src/public_api.d.ts +1 -0
  22. package/src/storage.module.d.ts +5 -1
  23. package/src/storage.plugin.d.ts +6 -4
  24. package/src/symbols.d.ts +10 -4
  25. package/bundles/ngxs-storage-plugin.umd.min.js +0 -16
  26. package/bundles/ngxs-storage-plugin.umd.min.js.map +0 -1
  27. package/esm5/index.js +0 -9
  28. package/esm5/ngxs-storage-plugin.js +0 -11
  29. package/esm5/src/internals.js +0 -77
  30. package/esm5/src/public_api.js +0 -8
  31. package/esm5/src/storage.module.js +0 -55
  32. package/esm5/src/storage.plugin.js +0 -244
  33. package/esm5/src/symbols.js +0 -93
  34. package/fesm5/ngxs-storage-plugin.js +0 -473
  35. package/fesm5/ngxs-storage-plugin.js.map +0 -1
  36. package/ngxs-storage-plugin.metadata.json +0 -1
@@ -1,473 +0,0 @@
1
- import { InjectionToken, Injectable, Inject, PLATFORM_ID, NgModule } from '@angular/core';
2
- import { StateToken, actionMatcher, InitState, UpdateState, getValue, setValue, NGXS_PLUGINS } from '@ngxs/store';
3
- import { __assign, __values } from 'tslib';
4
- import { isPlatformServer } from '@angular/common';
5
- import { tap } from 'rxjs/operators';
6
-
7
- /**
8
- * @fileoverview added by tsickle
9
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
10
- */
11
- /** @enum {number} */
12
- var StorageOption = {
13
- LocalStorage: 0,
14
- SessionStorage: 1,
15
- };
16
- /**
17
- * @record
18
- */
19
- function NgxsStoragePluginOptions() { }
20
- if (false) {
21
- /**
22
- * Key for the state slice to store in the storage engine.
23
- * @type {?|undefined}
24
- */
25
- NgxsStoragePluginOptions.prototype.key;
26
- /**
27
- * Storage engine to use. Deaults to localStorage but can provide
28
- *
29
- * sessionStorage or custom implementation of the StorageEngine interface
30
- * @type {?|undefined}
31
- */
32
- NgxsStoragePluginOptions.prototype.storage;
33
- /**
34
- * Migration strategies.
35
- * @type {?|undefined}
36
- */
37
- NgxsStoragePluginOptions.prototype.migrations;
38
- /**
39
- * Serailizer for the object before its pushed into the engine.
40
- * @param {?} obj
41
- * @return {?}
42
- */
43
- NgxsStoragePluginOptions.prototype.serialize = function (obj) { };
44
- /**
45
- * Deserializer for the object before its pulled out of the engine.
46
- * @param {?} obj
47
- * @return {?}
48
- */
49
- NgxsStoragePluginOptions.prototype.deserialize = function (obj) { };
50
- /**
51
- * Method to alter object before serialization.
52
- * @param {?} obj
53
- * @param {?} key
54
- * @return {?}
55
- */
56
- NgxsStoragePluginOptions.prototype.beforeSerialize = function (obj, key) { };
57
- /**
58
- * Method to alter object after deserialization.
59
- * @param {?} obj
60
- * @param {?} key
61
- * @return {?}
62
- */
63
- NgxsStoragePluginOptions.prototype.afterDeserialize = function (obj, key) { };
64
- }
65
- /** @type {?} */
66
- var NGXS_STORAGE_PLUGIN_OPTIONS = new InjectionToken('NGXS_STORAGE_PLUGIN_OPTION');
67
- /** @type {?} */
68
- var STORAGE_ENGINE = new InjectionToken('STORAGE_ENGINE');
69
- /**
70
- * @record
71
- */
72
- function StorageEngine() { }
73
- if (false) {
74
- /** @type {?} */
75
- StorageEngine.prototype.length;
76
- /**
77
- * @param {?} key
78
- * @return {?}
79
- */
80
- StorageEngine.prototype.getItem = function (key) { };
81
- /**
82
- * @param {?} key
83
- * @param {?} val
84
- * @return {?}
85
- */
86
- StorageEngine.prototype.setItem = function (key, val) { };
87
- /**
88
- * @param {?} key
89
- * @return {?}
90
- */
91
- StorageEngine.prototype.removeItem = function (key) { };
92
- /**
93
- * @return {?}
94
- */
95
- StorageEngine.prototype.clear = function () { };
96
- }
97
-
98
- /**
99
- * @fileoverview added by tsickle
100
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
101
- */
102
- /**
103
- * If the `key` option is not provided then the below constant
104
- * will be used as a default key
105
- * @type {?}
106
- */
107
- var DEFAULT_STATE_KEY = '@@STATE';
108
- /**
109
- * This key is used to retrieve static metadatas on state classes.
110
- * This constant is taken from the core codebase
111
- * @type {?}
112
- */
113
- var META_OPTIONS_KEY = 'NGXS_OPTIONS_META';
114
- /**
115
- * @param {?} key
116
- * @return {?}
117
- */
118
- function transformKeyOption(key) {
119
- if (!Array.isArray(key)) {
120
- key = [key];
121
- }
122
- return key.map((/**
123
- * @param {?} token
124
- * @return {?}
125
- */
126
- function (token) {
127
- // If it has the `NGXS_OPTIONS_META` key then it means the developer
128
- // has provided state class like `key: [AuthState]`.
129
- if (token.hasOwnProperty(META_OPTIONS_KEY)) {
130
- // The `name` property will be an actual state name or a `StateToken`.
131
- token = ((/** @type {?} */ (token)))[META_OPTIONS_KEY].name;
132
- }
133
- return token instanceof StateToken ? token.getName() : ((/** @type {?} */ (token)));
134
- }));
135
- }
136
- /**
137
- * @param {?} options
138
- * @return {?}
139
- */
140
- function storageOptionsFactory(options) {
141
- if (options !== undefined && options.key) {
142
- options.key = transformKeyOption(options.key);
143
- }
144
- return __assign({ key: [DEFAULT_STATE_KEY], storage: 0 /* LocalStorage */, serialize: JSON.stringify, deserialize: JSON.parse, beforeSerialize: (/**
145
- * @param {?} obj
146
- * @return {?}
147
- */
148
- function (obj) { return obj; }), afterDeserialize: (/**
149
- * @param {?} obj
150
- * @return {?}
151
- */
152
- function (obj) { return obj; }) }, options);
153
- }
154
- /**
155
- * @param {?} options
156
- * @param {?} platformId
157
- * @return {?}
158
- */
159
- function engineFactory(options, platformId) {
160
- if (isPlatformServer(platformId)) {
161
- return null;
162
- }
163
- if (options.storage === 0 /* LocalStorage */) {
164
- return localStorage;
165
- }
166
- else if (options.storage === 1 /* SessionStorage */) {
167
- return sessionStorage;
168
- }
169
- return null;
170
- }
171
-
172
- /**
173
- * @fileoverview added by tsickle
174
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
175
- */
176
- var NgxsStoragePlugin = /** @class */ (function () {
177
- function NgxsStoragePlugin(_options, _engine, _platformId) {
178
- this._options = _options;
179
- this._engine = _engine;
180
- this._platformId = _platformId;
181
- // We cast to `string[]` here as we're sure that this option has been
182
- // transformed by the `storageOptionsFactory` function that provided token.
183
- this._keys = (/** @type {?} */ (this._options.key));
184
- // We default to `[DEFAULT_STATE_KEY]` if the user explicitly does not provide the `key` option.
185
- this._usesDefaultStateKey = this._keys.length === 1 && this._keys[0] === DEFAULT_STATE_KEY;
186
- }
187
- /**
188
- * @param {?} state
189
- * @param {?} event
190
- * @param {?} next
191
- * @return {?}
192
- */
193
- NgxsStoragePlugin.prototype.handle = /**
194
- * @param {?} state
195
- * @param {?} event
196
- * @param {?} next
197
- * @return {?}
198
- */
199
- function (state, event, next) {
200
- var _this = this;
201
- var e_1, _a;
202
- if (isPlatformServer(this._platformId) && this._engine === null) {
203
- return next(state, event);
204
- }
205
- /** @type {?} */
206
- var matches = actionMatcher(event);
207
- /** @type {?} */
208
- var isInitAction = matches(InitState);
209
- /** @type {?} */
210
- var isUpdateAction = matches(UpdateState);
211
- /** @type {?} */
212
- var isInitOrUpdateAction = isInitAction || isUpdateAction;
213
- /** @type {?} */
214
- var hasMigration = false;
215
- if (isInitOrUpdateAction) {
216
- /** @type {?} */
217
- var addedStates = isUpdateAction && event.addedStates;
218
- var _loop_1 = function (key) {
219
- // We're checking what states have been added by NGXS and if any of these states should be handled by
220
- // the storage plugin. For instance, we only want to deserialize the `auth` state, NGXS has added
221
- // the `user` state, the storage plugin will be rerun and will do redundant deserialization.
222
- // `usesDefaultStateKey` is necessary to check since `event.addedStates` never contains `@@STATE`.
223
- if (!this_1._usesDefaultStateKey && addedStates) {
224
- // We support providing keys that can be deeply nested via dot notation, for instance,
225
- // `keys: ['myState.myProperty']` is a valid key.
226
- // The state name should always go first. The below code checks if the `key` includes dot
227
- // notation and extracts the state name out of the key.
228
- // Given the `key` is `myState.myProperty`, the `addedStates` will only contain `myState`.
229
- /** @type {?} */
230
- var dotNotationIndex = key.indexOf(DOT);
231
- /** @type {?} */
232
- var stateName = dotNotationIndex > -1 ? key.slice(0, dotNotationIndex) : key;
233
- if (!addedStates.hasOwnProperty(stateName)) {
234
- return "continue";
235
- }
236
- }
237
- /** @type {?} */
238
- var storedValue = this_1._engine.getItem((/** @type {?} */ (key)));
239
- if (storedValue !== 'undefined' && storedValue != null) {
240
- try {
241
- /** @type {?} */
242
- var newVal = (/** @type {?} */ (this_1._options.deserialize))(storedValue);
243
- storedValue = (/** @type {?} */ (this_1._options.afterDeserialize))(newVal, key);
244
- }
245
- catch (_a) {
246
- // Caretaker note: we have still left the `typeof` condition in order to avoid
247
- // creating a breaking change for projects that still use the View Engine.
248
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
249
- console.error("Error ocurred while deserializing the " + key + " store value, falling back to empty object, the value obtained from the store: ", storedValue);
250
- }
251
- storedValue = {};
252
- }
253
- if (this_1._options.migrations) {
254
- this_1._options.migrations.forEach((/**
255
- * @param {?} strategy
256
- * @return {?}
257
- */
258
- function (strategy) {
259
- /** @type {?} */
260
- var versionMatch = strategy.version === getValue(storedValue, strategy.versionKey || 'version');
261
- /** @type {?} */
262
- var keyMatch = (!strategy.key && _this._usesDefaultStateKey) || strategy.key === key;
263
- if (versionMatch && keyMatch) {
264
- storedValue = strategy.migrate(storedValue);
265
- hasMigration = true;
266
- }
267
- }));
268
- }
269
- if (!this_1._usesDefaultStateKey) {
270
- state = setValue(state, (/** @type {?} */ (key)), storedValue);
271
- }
272
- else {
273
- // The `UpdateState` action is dispatched whenever the feature state is added.
274
- // The below condition is met only when the `UpdateState` is dispatched.
275
- // Let's assume that we have 2 states `counter` and `@ngxs/router-plugin` state.
276
- // `CounterState` is provided on the root level when calling `NgxsModule.forRoot()`
277
- // and `@ngxs/router-plugin` is provided as a feature state.
278
- // The storage plugin may save the `counter` state value as `10` before.
279
- // The `CounterState` may implement the `ngxsOnInit` hook and call `ctx.setState(999)`.
280
- // The storage plugin will re-hydrate the whole state when the `RouterState` is registered,
281
- // and the `counter` state will again equal `10` (not `999`).
282
- if (storedValue && addedStates && Object.keys(addedStates).length > 0) {
283
- storedValue = Object.keys(addedStates).reduce((/**
284
- * @param {?} accumulator
285
- * @param {?} addedState
286
- * @return {?}
287
- */
288
- function (accumulator, addedState) {
289
- // The `storedValue` may equal the whole state (when the default state key is used).
290
- // If `addedStates` contains only `router` then we want to merge the state only
291
- // with the `router` value.
292
- // Let's assume that the `storedValue` is an object:
293
- // `{ counter: 10, router: {...} }`
294
- // This will pick only the `router` object from the `storedValue` and `counter`
295
- // state will not be re-hydrated unnecessary.
296
- if (storedValue.hasOwnProperty(addedState)) {
297
- accumulator[addedState] = storedValue[addedState];
298
- }
299
- return accumulator;
300
- }), (/** @type {?} */ ({})));
301
- }
302
- state = __assign({}, state, storedValue);
303
- }
304
- }
305
- };
306
- var this_1 = this;
307
- try {
308
- for (var _b = __values(this._keys), _c = _b.next(); !_c.done; _c = _b.next()) {
309
- var key = _c.value;
310
- _loop_1(key);
311
- }
312
- }
313
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
314
- finally {
315
- try {
316
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
317
- }
318
- finally { if (e_1) throw e_1.error; }
319
- }
320
- }
321
- return next(state, event).pipe(tap((/**
322
- * @param {?} nextState
323
- * @return {?}
324
- */
325
- function (nextState) {
326
- var e_2, _a;
327
- if (!isInitOrUpdateAction || (isInitOrUpdateAction && hasMigration)) {
328
- try {
329
- for (var _b = __values(_this._keys), _c = _b.next(); !_c.done; _c = _b.next()) {
330
- var key = _c.value;
331
- /** @type {?} */
332
- var val = nextState;
333
- if (key !== DEFAULT_STATE_KEY) {
334
- val = getValue(nextState, (/** @type {?} */ (key)));
335
- }
336
- try {
337
- /** @type {?} */
338
- var newVal = (/** @type {?} */ (_this._options.beforeSerialize))(val, key);
339
- _this._engine.setItem((/** @type {?} */ (key)), (/** @type {?} */ (_this._options.serialize))(newVal));
340
- }
341
- catch (error) {
342
- // Caretaker note: we have still left the `typeof` condition in order to avoid
343
- // creating a breaking change for projects that still use the View Engine.
344
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
345
- if (error &&
346
- (error.name === 'QuotaExceededError' ||
347
- error.name === 'NS_ERROR_DOM_QUOTA_REACHED')) {
348
- console.error("The " + key + " store value exceeds the browser storage quota: ", val);
349
- }
350
- else {
351
- console.error("Error ocurred while serializing the " + key + " store value, value not updated, the value obtained from the store: ", val);
352
- }
353
- }
354
- }
355
- }
356
- }
357
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
358
- finally {
359
- try {
360
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
361
- }
362
- finally { if (e_2) throw e_2.error; }
363
- }
364
- }
365
- })));
366
- };
367
- NgxsStoragePlugin.decorators = [
368
- { type: Injectable }
369
- ];
370
- /** @nocollapse */
371
- NgxsStoragePlugin.ctorParameters = function () { return [
372
- { type: undefined, decorators: [{ type: Inject, args: [NGXS_STORAGE_PLUGIN_OPTIONS,] }] },
373
- { type: undefined, decorators: [{ type: Inject, args: [STORAGE_ENGINE,] }] },
374
- { type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
375
- ]; };
376
- return NgxsStoragePlugin;
377
- }());
378
- if (false) {
379
- /**
380
- * @type {?}
381
- * @private
382
- */
383
- NgxsStoragePlugin.prototype._keys;
384
- /**
385
- * @type {?}
386
- * @private
387
- */
388
- NgxsStoragePlugin.prototype._usesDefaultStateKey;
389
- /**
390
- * @type {?}
391
- * @private
392
- */
393
- NgxsStoragePlugin.prototype._options;
394
- /**
395
- * @type {?}
396
- * @private
397
- */
398
- NgxsStoragePlugin.prototype._engine;
399
- /**
400
- * @type {?}
401
- * @private
402
- */
403
- NgxsStoragePlugin.prototype._platformId;
404
- }
405
- /** @type {?} */
406
- var DOT = '.';
407
-
408
- /**
409
- * @fileoverview added by tsickle
410
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
411
- */
412
- /** @type {?} */
413
- var USER_OPTIONS = new InjectionToken('USER_OPTIONS');
414
- var NgxsStoragePluginModule = /** @class */ (function () {
415
- function NgxsStoragePluginModule() {
416
- }
417
- /**
418
- * @param {?=} options
419
- * @return {?}
420
- */
421
- NgxsStoragePluginModule.forRoot = /**
422
- * @param {?=} options
423
- * @return {?}
424
- */
425
- function (options) {
426
- return {
427
- ngModule: NgxsStoragePluginModule,
428
- providers: [
429
- {
430
- provide: NGXS_PLUGINS,
431
- useClass: NgxsStoragePlugin,
432
- multi: true
433
- },
434
- {
435
- provide: USER_OPTIONS,
436
- useValue: options
437
- },
438
- {
439
- provide: NGXS_STORAGE_PLUGIN_OPTIONS,
440
- useFactory: storageOptionsFactory,
441
- deps: [USER_OPTIONS]
442
- },
443
- {
444
- provide: STORAGE_ENGINE,
445
- useFactory: engineFactory,
446
- deps: [NGXS_STORAGE_PLUGIN_OPTIONS, PLATFORM_ID]
447
- }
448
- ]
449
- };
450
- };
451
- NgxsStoragePluginModule.decorators = [
452
- { type: NgModule }
453
- ];
454
- return NgxsStoragePluginModule;
455
- }());
456
-
457
- /**
458
- * @fileoverview added by tsickle
459
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
460
- */
461
-
462
- /**
463
- * @fileoverview added by tsickle
464
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
465
- */
466
-
467
- /**
468
- * @fileoverview added by tsickle
469
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
470
- */
471
-
472
- export { NGXS_STORAGE_PLUGIN_OPTIONS, NgxsStoragePlugin, NgxsStoragePluginModule, STORAGE_ENGINE, USER_OPTIONS as ɵa, storageOptionsFactory as ɵb, engineFactory as ɵc };
473
- //# sourceMappingURL=ngxs-storage-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngxs-storage-plugin.js","sources":["ng://@ngxs/storage-plugin/src/symbols.ts","ng://@ngxs/storage-plugin/src/internals.ts","ng://@ngxs/storage-plugin/src/storage.plugin.ts","ng://@ngxs/storage-plugin/src/storage.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { StorageKey } from './internals';\n\nexport const enum StorageOption {\n LocalStorage,\n SessionStorage\n}\n\nexport interface NgxsStoragePluginOptions {\n /**\n * Key for the state slice to store in the storage engine.\n */\n key?: undefined | StorageKey;\n\n /**\n * Storage engine to use. Deaults to localStorage but can provide\n *\n * sessionStorage or custom implementation of the StorageEngine interface\n */\n storage?: StorageOption;\n\n /**\n * Migration strategies.\n */\n migrations?: {\n /**\n * Version to key off.\n */\n version: number | string;\n\n /**\n * Method to migrate the previous state.\n */\n migrate: (state: any) => any;\n\n /**\n * Key to migrate.\n */\n key?: string;\n\n /**\n * Key for the version. Defaults to 'version'.\n */\n versionKey?: string;\n }[];\n\n /**\n * Serailizer for the object before its pushed into the engine.\n */\n serialize?(obj: any): string;\n\n /**\n * Deserializer for the object before its pulled out of the engine.\n */\n deserialize?(obj: any): any;\n\n /**\n * Method to alter object before serialization.\n */\n beforeSerialize?(obj: any, key: string): any;\n\n /**\n * Method to alter object after deserialization.\n */\n afterDeserialize?(obj: any, key: string): any;\n}\n\nexport const NGXS_STORAGE_PLUGIN_OPTIONS = new InjectionToken('NGXS_STORAGE_PLUGIN_OPTION');\n\nexport const STORAGE_ENGINE = new InjectionToken('STORAGE_ENGINE');\n\nexport interface StorageEngine {\n readonly length: number;\n getItem(key: string): any;\n setItem(key: string, val: any): void;\n removeItem(key: string): void;\n clear(): void;\n}\n","import { isPlatformServer } from '@angular/common';\nimport { StateClass } from '@ngxs/store/internals';\nimport { StateToken } from '@ngxs/store';\n\nimport { StorageOption, StorageEngine, NgxsStoragePluginOptions } from './symbols';\n\n/**\n * If the `key` option is not provided then the below constant\n * will be used as a default key\n */\nexport const DEFAULT_STATE_KEY = '@@STATE';\n\n/**\n * Internal type definition for the `key` option provided\n * in the `forRoot` method when importing module\n */\nexport type StorageKey =\n | string\n | StateClass\n | StateToken<any>\n | (string | StateClass | StateToken<any>)[];\n\n/**\n * This key is used to retrieve static metadatas on state classes.\n * This constant is taken from the core codebase\n */\nconst META_OPTIONS_KEY = 'NGXS_OPTIONS_META';\n\nfunction transformKeyOption(key: StorageKey): string[] {\n if (!Array.isArray(key)) {\n key = [key];\n }\n\n return key.map((token: string | StateClass | StateToken<any>) => {\n // If it has the `NGXS_OPTIONS_META` key then it means the developer\n // has provided state class like `key: [AuthState]`.\n if (token.hasOwnProperty(META_OPTIONS_KEY)) {\n // The `name` property will be an actual state name or a `StateToken`.\n token = (token as any)[META_OPTIONS_KEY].name;\n }\n\n return token instanceof StateToken ? token.getName() : (token as string);\n });\n}\n\nexport function storageOptionsFactory(\n options: NgxsStoragePluginOptions | undefined\n): NgxsStoragePluginOptions {\n if (options !== undefined && options.key) {\n options.key = transformKeyOption(options.key);\n }\n\n return {\n key: [DEFAULT_STATE_KEY],\n storage: StorageOption.LocalStorage,\n serialize: JSON.stringify,\n deserialize: JSON.parse,\n beforeSerialize: obj => obj,\n afterDeserialize: obj => obj,\n ...options\n };\n}\n\nexport function engineFactory(\n options: NgxsStoragePluginOptions,\n platformId: string\n): StorageEngine | null {\n if (isPlatformServer(platformId)) {\n return null;\n }\n\n if (options.storage === StorageOption.LocalStorage) {\n return localStorage;\n } else if (options.storage === StorageOption.SessionStorage) {\n return sessionStorage;\n }\n\n return null;\n}\n","import { PLATFORM_ID, Inject, Injectable } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { PlainObject } from '@ngxs/store/internals';\nimport {\n NgxsPlugin,\n setValue,\n getValue,\n InitState,\n UpdateState,\n actionMatcher,\n NgxsNextPluginFn\n} from '@ngxs/store';\nimport { tap } from 'rxjs/operators';\n\nimport {\n StorageEngine,\n NgxsStoragePluginOptions,\n STORAGE_ENGINE,\n NGXS_STORAGE_PLUGIN_OPTIONS\n} from './symbols';\nimport { DEFAULT_STATE_KEY } from './internals';\n\n/**\n * @description Will be provided through Terser global definitions by Angular CLI\n * during the production build. This is how Angular does tree-shaking internally.\n */\ndeclare const ngDevMode: boolean;\n\n@Injectable()\nexport class NgxsStoragePlugin implements NgxsPlugin {\n // We cast to `string[]` here as we're sure that this option has been\n // transformed by the `storageOptionsFactory` function that provided token.\n private _keys = this._options.key as string[];\n // We default to `[DEFAULT_STATE_KEY]` if the user explicitly does not provide the `key` option.\n private _usesDefaultStateKey =\n this._keys.length === 1 && this._keys[0] === DEFAULT_STATE_KEY;\n\n constructor(\n @Inject(NGXS_STORAGE_PLUGIN_OPTIONS) private _options: NgxsStoragePluginOptions,\n @Inject(STORAGE_ENGINE) private _engine: StorageEngine,\n @Inject(PLATFORM_ID) private _platformId: string\n ) {}\n\n handle(state: any, event: any, next: NgxsNextPluginFn) {\n if (isPlatformServer(this._platformId) && this._engine === null) {\n return next(state, event);\n }\n\n const matches = actionMatcher(event);\n const isInitAction = matches(InitState);\n const isUpdateAction = matches(UpdateState);\n const isInitOrUpdateAction = isInitAction || isUpdateAction;\n let hasMigration = false;\n\n if (isInitOrUpdateAction) {\n const addedStates = isUpdateAction && event.addedStates;\n\n for (const key of this._keys) {\n // We're checking what states have been added by NGXS and if any of these states should be handled by\n // the storage plugin. For instance, we only want to deserialize the `auth` state, NGXS has added\n // the `user` state, the storage plugin will be rerun and will do redundant deserialization.\n // `usesDefaultStateKey` is necessary to check since `event.addedStates` never contains `@@STATE`.\n if (!this._usesDefaultStateKey && addedStates) {\n // We support providing keys that can be deeply nested via dot notation, for instance,\n // `keys: ['myState.myProperty']` is a valid key.\n // The state name should always go first. The below code checks if the `key` includes dot\n // notation and extracts the state name out of the key.\n // Given the `key` is `myState.myProperty`, the `addedStates` will only contain `myState`.\n const dotNotationIndex = key.indexOf(DOT);\n const stateName = dotNotationIndex > -1 ? key.slice(0, dotNotationIndex) : key;\n if (!addedStates.hasOwnProperty(stateName)) {\n continue;\n }\n }\n\n let storedValue: any = this._engine.getItem(key!);\n\n if (storedValue !== 'undefined' && storedValue != null) {\n try {\n const newVal = this._options.deserialize!(storedValue);\n storedValue = this._options.afterDeserialize!(newVal, key);\n } catch {\n // Caretaker note: we have still left the `typeof` condition in order to avoid\n // creating a breaking change for projects that still use the View Engine.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.error(\n `Error ocurred while deserializing the ${key} store value, falling back to empty object, the value obtained from the store: `,\n storedValue\n );\n }\n storedValue = {};\n }\n\n if (this._options.migrations) {\n this._options.migrations.forEach(strategy => {\n const versionMatch =\n strategy.version === getValue(storedValue, strategy.versionKey || 'version');\n const keyMatch =\n (!strategy.key && this._usesDefaultStateKey) || strategy.key === key;\n if (versionMatch && keyMatch) {\n storedValue = strategy.migrate(storedValue);\n hasMigration = true;\n }\n });\n }\n\n if (!this._usesDefaultStateKey) {\n state = setValue(state, key!, storedValue);\n } else {\n // The `UpdateState` action is dispatched whenever the feature state is added.\n // The below condition is met only when the `UpdateState` is dispatched.\n // Let's assume that we have 2 states `counter` and `@ngxs/router-plugin` state.\n // `CounterState` is provided on the root level when calling `NgxsModule.forRoot()`\n // and `@ngxs/router-plugin` is provided as a feature state.\n // The storage plugin may save the `counter` state value as `10` before.\n // The `CounterState` may implement the `ngxsOnInit` hook and call `ctx.setState(999)`.\n // The storage plugin will re-hydrate the whole state when the `RouterState` is registered,\n // and the `counter` state will again equal `10` (not `999`).\n if (storedValue && addedStates && Object.keys(addedStates).length > 0) {\n storedValue = Object.keys(addedStates).reduce((accumulator, addedState) => {\n // The `storedValue` may equal the whole state (when the default state key is used).\n // If `addedStates` contains only `router` then we want to merge the state only\n // with the `router` value.\n // Let's assume that the `storedValue` is an object:\n // `{ counter: 10, router: {...} }`\n // This will pick only the `router` object from the `storedValue` and `counter`\n // state will not be re-hydrated unnecessary.\n if (storedValue.hasOwnProperty(addedState)) {\n accumulator[addedState] = storedValue[addedState];\n }\n return accumulator;\n }, <PlainObject>{});\n }\n\n state = { ...state, ...storedValue };\n }\n }\n }\n }\n\n return next(state, event).pipe(\n tap(nextState => {\n if (!isInitOrUpdateAction || (isInitOrUpdateAction && hasMigration)) {\n for (const key of this._keys) {\n let val = nextState;\n\n if (key !== DEFAULT_STATE_KEY) {\n val = getValue(nextState, key!);\n }\n\n try {\n const newVal = this._options.beforeSerialize!(val, key);\n this._engine.setItem(key!, this._options.serialize!(newVal));\n } catch (error) {\n // Caretaker note: we have still left the `typeof` condition in order to avoid\n // creating a breaking change for projects that still use the View Engine.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (\n error &&\n (error.name === 'QuotaExceededError' ||\n error.name === 'NS_ERROR_DOM_QUOTA_REACHED')\n ) {\n console.error(\n `The ${key} store value exceeds the browser storage quota: `,\n val\n );\n } else {\n console.error(\n `Error ocurred while serializing the ${key} store value, value not updated, the value obtained from the store: `,\n val\n );\n }\n }\n }\n }\n }\n })\n );\n }\n}\n\nconst DOT = '.';\n","import { NgModule, ModuleWithProviders, PLATFORM_ID, InjectionToken } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\n\nimport {\n NgxsStoragePluginOptions,\n STORAGE_ENGINE,\n NGXS_STORAGE_PLUGIN_OPTIONS\n} from './symbols';\nimport { NgxsStoragePlugin } from './storage.plugin';\nimport { storageOptionsFactory, engineFactory } from './internals';\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsStoragePluginModule {\n static forRoot(\n options?: NgxsStoragePluginOptions\n ): ModuleWithProviders<NgxsStoragePluginModule> {\n return {\n ngModule: NgxsStoragePluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsStoragePlugin,\n multi: true\n },\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_STORAGE_PLUGIN_OPTIONS,\n useFactory: storageOptionsFactory,\n deps: [USER_OPTIONS]\n },\n {\n provide: STORAGE_ENGINE,\n useFactory: engineFactory,\n deps: [NGXS_STORAGE_PLUGIN_OPTIONS, PLATFORM_ID]\n }\n ]\n };\n }\n}\n"],"names":["tslib_1.__values"],"mappings":";;;;;;;;;;AAAA;;IAKE,eAAY;IACZ,iBAAc;;;;;AAGhB,uCAyDC;;;;;;IArDC,uCAA6B;;;;;;;IAO7B,2CAAwB;;;;;IAKxB,8CAoBI;;;;;;IAKJ,kEAA6B;;;;;;IAK7B,oEAA4B;;;;;;;IAK5B,6EAA6C;;;;;;;IAK7C,8EAA8C;;;AAGhD,IAAa,2BAA2B,GAAG,IAAI,cAAc,CAAC,4BAA4B,CAAC;;AAE3F,IAAa,cAAc,GAAG,IAAI,cAAc,CAAC,gBAAgB,CAAC;;;;AAElE,4BAMC;;;IALC,+BAAwB;;;;;IACxB,qDAA0B;;;;;;IAC1B,0DAAqC;;;;;IACrC,wDAA8B;;;;IAC9B,gDAAc;;;;;;;;;;;;ACnEhB,IAAa,iBAAiB,GAAG,SAAS;;;;;;IAgBpC,gBAAg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","version":4,"metadata":{"ɵa":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":11,"character":32},"arguments":["USER_OPTIONS"]},"NgxsStoragePluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsStoragePluginModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngxs/store","name":"NGXS_PLUGINS","line":22,"character":19},"useClass":{"__symbolic":"reference","name":"NgxsStoragePlugin"},"multi":true},{"provide":{"__symbolic":"reference","name":"ɵa"},"useValue":{"__symbolic":"reference","name":"options"}},{"provide":{"__symbolic":"reference","name":"NGXS_STORAGE_PLUGIN_OPTIONS"},"useFactory":{"__symbolic":"reference","name":"ɵb"},"deps":[{"__symbolic":"reference","name":"ɵa"}]},{"provide":{"__symbolic":"reference","name":"STORAGE_ENGINE"},"useFactory":{"__symbolic":"reference","name":"ɵc"},"deps":[{"__symbolic":"reference","name":"NGXS_STORAGE_PLUGIN_OPTIONS"},{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":38,"character":46}]}]}}}},"NgxsStoragePlugin":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":28,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_STORAGE_PLUGIN_OPTIONS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":39,"character":5},"arguments":[{"__symbolic":"reference","name":"STORAGE_ENGINE"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":40,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":40,"character":12}]}]],"parameters":[{"__symbolic":"reference","name":"NgxsStoragePluginOptions"},{"__symbolic":"reference","name":"StorageEngine"},{"__symbolic":"reference","name":"string"}]}],"handle":[{"__symbolic":"method"}]}},"StorageOption":{"LocalStorage":0,"SessionStorage":1},"NgxsStoragePluginOptions":{"__symbolic":"interface"},"NGXS_STORAGE_PLUGIN_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":68,"character":47},"arguments":["NGXS_STORAGE_PLUGIN_OPTION"]},"STORAGE_ENGINE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":70,"character":34},"arguments":["STORAGE_ENGINE"]},"StorageEngine":{"__symbolic":"interface"},"ɵb":{"__symbolic":"function"},"ɵc":{"__symbolic":"function"}},"origins":{"ɵa":"./src/storage.module","NgxsStoragePluginModule":"./src/storage.module","NgxsStoragePlugin":"./src/storage.plugin","StorageOption":"./src/symbols","NgxsStoragePluginOptions":"./src/symbols","NGXS_STORAGE_PLUGIN_OPTIONS":"./src/symbols","STORAGE_ENGINE":"./src/symbols","StorageEngine":"./src/symbols","ɵb":"./src/internals","ɵc":"./src/internals"},"importAs":"@ngxs/storage-plugin"}