@ngxs/storage-plugin 3.7.3-dev.master-10b0883 → 3.7.4-temp

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.
@@ -223,393 +223,393 @@
223
223
  return value;
224
224
  }
225
225
 
226
- /**
227
- * @fileoverview added by tsickle
228
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
229
- */
230
- /** @enum {number} */
231
- var StorageOption = {
232
- LocalStorage: 0,
233
- SessionStorage: 1,
234
- };
235
- /**
236
- * @record
237
- */
238
- function NgxsStoragePluginOptions() { }
239
- if (false) {
240
- /**
241
- * Key for the state slice to store in the storage engine.
242
- * @type {?|undefined}
243
- */
244
- NgxsStoragePluginOptions.prototype.key;
245
- /**
246
- * Storage engine to use. Deaults to localStorage but can provide
247
- *
248
- * sessionStorage or custom implementation of the StorageEngine interface
249
- * @type {?|undefined}
250
- */
251
- NgxsStoragePluginOptions.prototype.storage;
252
- /**
253
- * Migration strategies.
254
- * @type {?|undefined}
255
- */
256
- NgxsStoragePluginOptions.prototype.migrations;
257
- /**
258
- * Serailizer for the object before its pushed into the engine.
259
- * @param {?} obj
260
- * @return {?}
261
- */
262
- NgxsStoragePluginOptions.prototype.serialize = function (obj) { };
263
- /**
264
- * Deserializer for the object before its pulled out of the engine.
265
- * @param {?} obj
266
- * @return {?}
267
- */
268
- NgxsStoragePluginOptions.prototype.deserialize = function (obj) { };
269
- /**
270
- * Method to alter object before serialization.
271
- * @param {?} obj
272
- * @param {?} key
273
- * @return {?}
274
- */
275
- NgxsStoragePluginOptions.prototype.beforeSerialize = function (obj, key) { };
276
- /**
277
- * Method to alter object after deserialization.
278
- * @param {?} obj
279
- * @param {?} key
280
- * @return {?}
281
- */
282
- NgxsStoragePluginOptions.prototype.afterDeserialize = function (obj, key) { };
283
- }
284
- /** @type {?} */
285
- var NGXS_STORAGE_PLUGIN_OPTIONS = new core.InjectionToken('NGXS_STORAGE_PLUGIN_OPTION');
286
- /** @type {?} */
287
- var STORAGE_ENGINE = new core.InjectionToken('STORAGE_ENGINE');
288
- /**
289
- * @record
290
- */
291
- function StorageEngine() { }
292
- if (false) {
293
- /** @type {?} */
294
- StorageEngine.prototype.length;
295
- /**
296
- * @param {?} key
297
- * @return {?}
298
- */
299
- StorageEngine.prototype.getItem = function (key) { };
300
- /**
301
- * @param {?} key
302
- * @param {?} val
303
- * @return {?}
304
- */
305
- StorageEngine.prototype.setItem = function (key, val) { };
306
- /**
307
- * @param {?} key
308
- * @return {?}
309
- */
310
- StorageEngine.prototype.removeItem = function (key) { };
311
- /**
312
- * @return {?}
313
- */
314
- StorageEngine.prototype.clear = function () { };
226
+ /**
227
+ * @fileoverview added by tsickle
228
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
229
+ */
230
+ /** @enum {number} */
231
+ var StorageOption = {
232
+ LocalStorage: 0,
233
+ SessionStorage: 1,
234
+ };
235
+ /**
236
+ * @record
237
+ */
238
+ function NgxsStoragePluginOptions() { }
239
+ if (false) {
240
+ /**
241
+ * Key for the state slice to store in the storage engine.
242
+ * @type {?|undefined}
243
+ */
244
+ NgxsStoragePluginOptions.prototype.key;
245
+ /**
246
+ * Storage engine to use. Deaults to localStorage but can provide
247
+ *
248
+ * sessionStorage or custom implementation of the StorageEngine interface
249
+ * @type {?|undefined}
250
+ */
251
+ NgxsStoragePluginOptions.prototype.storage;
252
+ /**
253
+ * Migration strategies.
254
+ * @type {?|undefined}
255
+ */
256
+ NgxsStoragePluginOptions.prototype.migrations;
257
+ /**
258
+ * Serailizer for the object before its pushed into the engine.
259
+ * @param {?} obj
260
+ * @return {?}
261
+ */
262
+ NgxsStoragePluginOptions.prototype.serialize = function (obj) { };
263
+ /**
264
+ * Deserializer for the object before its pulled out of the engine.
265
+ * @param {?} obj
266
+ * @return {?}
267
+ */
268
+ NgxsStoragePluginOptions.prototype.deserialize = function (obj) { };
269
+ /**
270
+ * Method to alter object before serialization.
271
+ * @param {?} obj
272
+ * @param {?} key
273
+ * @return {?}
274
+ */
275
+ NgxsStoragePluginOptions.prototype.beforeSerialize = function (obj, key) { };
276
+ /**
277
+ * Method to alter object after deserialization.
278
+ * @param {?} obj
279
+ * @param {?} key
280
+ * @return {?}
281
+ */
282
+ NgxsStoragePluginOptions.prototype.afterDeserialize = function (obj, key) { };
283
+ }
284
+ /** @type {?} */
285
+ var NGXS_STORAGE_PLUGIN_OPTIONS = new core.InjectionToken('NGXS_STORAGE_PLUGIN_OPTION');
286
+ /** @type {?} */
287
+ var STORAGE_ENGINE = new core.InjectionToken('STORAGE_ENGINE');
288
+ /**
289
+ * @record
290
+ */
291
+ function StorageEngine() { }
292
+ if (false) {
293
+ /** @type {?} */
294
+ StorageEngine.prototype.length;
295
+ /**
296
+ * @param {?} key
297
+ * @return {?}
298
+ */
299
+ StorageEngine.prototype.getItem = function (key) { };
300
+ /**
301
+ * @param {?} key
302
+ * @param {?} val
303
+ * @return {?}
304
+ */
305
+ StorageEngine.prototype.setItem = function (key, val) { };
306
+ /**
307
+ * @param {?} key
308
+ * @return {?}
309
+ */
310
+ StorageEngine.prototype.removeItem = function (key) { };
311
+ /**
312
+ * @return {?}
313
+ */
314
+ StorageEngine.prototype.clear = function () { };
315
315
  }
316
316
 
317
- /**
318
- * @fileoverview added by tsickle
319
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
320
- */
321
- /**
322
- * If the `key` option is not provided then the below constant
323
- * will be used as a default key
324
- * @type {?}
325
- */
326
- var DEFAULT_STATE_KEY = '@@STATE';
327
- /**
328
- * This key is used to retrieve static metadatas on state classes.
329
- * This constant is taken from the core codebase
330
- * @type {?}
331
- */
332
- var META_OPTIONS_KEY = 'NGXS_OPTIONS_META';
333
- /**
334
- * @param {?} key
335
- * @return {?}
336
- */
337
- function transformKeyOption(key) {
338
- if (!Array.isArray(key)) {
339
- key = [key];
340
- }
341
- return key.map((/**
342
- * @param {?} token
343
- * @return {?}
344
- */
345
- function (token) {
346
- // If it has the `NGXS_OPTIONS_META` key then it means the developer
347
- // has provided state class like `key: [AuthState]`.
348
- if (token.hasOwnProperty(META_OPTIONS_KEY)) {
349
- // The `name` property will be an actual state name or a `StateToken`.
350
- token = ((/** @type {?} */ (token)))[META_OPTIONS_KEY].name;
351
- }
352
- return token instanceof store.StateToken ? token.getName() : ((/** @type {?} */ (token)));
353
- }));
354
- }
355
- /**
356
- * @param {?} options
357
- * @return {?}
358
- */
359
- function storageOptionsFactory(options) {
360
- if (options !== undefined && options.key) {
361
- options.key = transformKeyOption(options.key);
362
- }
363
- return __assign({ key: [DEFAULT_STATE_KEY], storage: 0 /* LocalStorage */, serialize: JSON.stringify, deserialize: JSON.parse, beforeSerialize: (/**
364
- * @param {?} obj
365
- * @return {?}
366
- */
367
- function (obj) { return obj; }), afterDeserialize: (/**
368
- * @param {?} obj
369
- * @return {?}
370
- */
371
- function (obj) { return obj; }) }, options);
372
- }
373
- /**
374
- * @param {?} options
375
- * @param {?} platformId
376
- * @return {?}
377
- */
378
- function engineFactory(options, platformId) {
379
- if (common.isPlatformServer(platformId)) {
380
- return null;
381
- }
382
- if (options.storage === 0 /* LocalStorage */) {
383
- return localStorage;
384
- }
385
- else if (options.storage === 1 /* SessionStorage */) {
386
- return sessionStorage;
387
- }
388
- return null;
317
+ /**
318
+ * @fileoverview added by tsickle
319
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
320
+ */
321
+ /**
322
+ * If the `key` option is not provided then the below constant
323
+ * will be used as a default key
324
+ * @type {?}
325
+ */
326
+ var DEFAULT_STATE_KEY = '@@STATE';
327
+ /**
328
+ * This key is used to retrieve static metadatas on state classes.
329
+ * This constant is taken from the core codebase
330
+ * @type {?}
331
+ */
332
+ var META_OPTIONS_KEY = 'NGXS_OPTIONS_META';
333
+ /**
334
+ * @param {?} key
335
+ * @return {?}
336
+ */
337
+ function transformKeyOption(key) {
338
+ if (!Array.isArray(key)) {
339
+ key = [key];
340
+ }
341
+ return key.map((/**
342
+ * @param {?} token
343
+ * @return {?}
344
+ */
345
+ function (token) {
346
+ // If it has the `NGXS_OPTIONS_META` key then it means the developer
347
+ // has provided state class like `key: [AuthState]`.
348
+ if (token.hasOwnProperty(META_OPTIONS_KEY)) {
349
+ // The `name` property will be an actual state name or a `StateToken`.
350
+ token = ((/** @type {?} */ (token)))[META_OPTIONS_KEY].name;
351
+ }
352
+ return token instanceof store.StateToken ? token.getName() : ((/** @type {?} */ (token)));
353
+ }));
354
+ }
355
+ /**
356
+ * @param {?} options
357
+ * @return {?}
358
+ */
359
+ function storageOptionsFactory(options) {
360
+ if (options !== undefined && options.key) {
361
+ options.key = transformKeyOption(options.key);
362
+ }
363
+ return __assign({ key: [DEFAULT_STATE_KEY], storage: 0 /* LocalStorage */, serialize: JSON.stringify, deserialize: JSON.parse, beforeSerialize: (/**
364
+ * @param {?} obj
365
+ * @return {?}
366
+ */
367
+ function (obj) { return obj; }), afterDeserialize: (/**
368
+ * @param {?} obj
369
+ * @return {?}
370
+ */
371
+ function (obj) { return obj; }) }, options);
372
+ }
373
+ /**
374
+ * @param {?} options
375
+ * @param {?} platformId
376
+ * @return {?}
377
+ */
378
+ function engineFactory(options, platformId) {
379
+ if (common.isPlatformServer(platformId)) {
380
+ return null;
381
+ }
382
+ if (options.storage === 0 /* LocalStorage */) {
383
+ return localStorage;
384
+ }
385
+ else if (options.storage === 1 /* SessionStorage */) {
386
+ return sessionStorage;
387
+ }
388
+ return null;
389
389
  }
390
390
 
391
- /**
392
- * @fileoverview added by tsickle
393
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
394
- */
395
- var NgxsStoragePlugin = /** @class */ (function () {
396
- function NgxsStoragePlugin(_options, _engine, _platformId) {
397
- this._options = _options;
398
- this._engine = _engine;
399
- this._platformId = _platformId;
400
- }
401
- /**
402
- * @param {?} state
403
- * @param {?} event
404
- * @param {?} next
405
- * @return {?}
406
- */
407
- NgxsStoragePlugin.prototype.handle = /**
408
- * @param {?} state
409
- * @param {?} event
410
- * @param {?} next
411
- * @return {?}
412
- */
413
- function (state, event, next) {
414
- var _this = this;
415
- var e_1, _a;
416
- if (common.isPlatformServer(this._platformId) && this._engine === null) {
417
- return next(state, event);
418
- }
419
- // We cast to `string[]` here as we're sure that this option has been
420
- // transformed by the `storageOptionsFactory` function that provided token
421
- /** @type {?} */
422
- var keys = (/** @type {?} */ (this._options.key));
423
- /** @type {?} */
424
- var matches = store.actionMatcher(event);
425
- /** @type {?} */
426
- var isInitAction = matches(store.InitState);
427
- /** @type {?} */
428
- var isUpdateAction = matches(store.UpdateState);
429
- /** @type {?} */
430
- var isInitOrUpdateAction = isInitAction || isUpdateAction;
431
- /** @type {?} */
432
- var hasMigration = false;
433
- if (isInitOrUpdateAction) {
434
- var _loop_1 = function (key) {
435
- // We're checking what states have been added by NGXS and if any of these states should be handled by
436
- // the storage plugin. For instance, we only want to deserialize the `auth` state, NGXS has added
437
- // the `user` state, the storage plugin will be rerun and will do redundant deserialization.
438
- if (isUpdateAction && event.addedStates && !event.addedStates.hasOwnProperty(key)) {
439
- return "continue";
440
- }
441
- /** @type {?} */
442
- var isMaster = key === DEFAULT_STATE_KEY;
443
- /** @type {?} */
444
- var val = this_1._engine.getItem((/** @type {?} */ (key)));
445
- if (val !== 'undefined' && val != null) {
446
- try {
447
- /** @type {?} */
448
- var newVal = (/** @type {?} */ (this_1._options.deserialize))(val);
449
- val = (/** @type {?} */ (this_1._options.afterDeserialize))(newVal, key);
450
- }
451
- catch (e) {
452
- // Caretaker note: we have still left the `typeof` condition in order to avoid
453
- // creating a breaking change for projects that still use the View Engine.
454
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
455
- console.error("Error ocurred while deserializing the " + key + " store value, falling back to empty object, the value obtained from the store: ", val);
456
- }
457
- val = {};
458
- }
459
- if (this_1._options.migrations) {
460
- this_1._options.migrations.forEach((/**
461
- * @param {?} strategy
462
- * @return {?}
463
- */
464
- function (strategy) {
465
- /** @type {?} */
466
- var versionMatch = strategy.version === store.getValue(val, strategy.versionKey || 'version');
467
- /** @type {?} */
468
- var keyMatch = (!strategy.key && isMaster) || strategy.key === key;
469
- if (versionMatch && keyMatch) {
470
- val = strategy.migrate(val);
471
- hasMigration = true;
472
- }
473
- }));
474
- }
475
- if (!isMaster) {
476
- state = store.setValue(state, (/** @type {?} */ (key)), val);
477
- }
478
- else {
479
- state = __assign({}, state, val);
480
- }
481
- }
482
- };
483
- var this_1 = this;
484
- try {
485
- for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
486
- var key = keys_1_1.value;
487
- _loop_1(key);
488
- }
489
- }
490
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
491
- finally {
492
- try {
493
- if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
494
- }
495
- finally { if (e_1) throw e_1.error; }
496
- }
497
- }
498
- return next(state, event).pipe(operators.tap((/**
499
- * @param {?} nextState
500
- * @return {?}
501
- */
502
- function (nextState) {
503
- var e_2, _a;
504
- if (!isInitOrUpdateAction || (isInitOrUpdateAction && hasMigration)) {
505
- try {
506
- for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) {
507
- var key = keys_2_1.value;
508
- /** @type {?} */
509
- var val = nextState;
510
- if (key !== DEFAULT_STATE_KEY) {
511
- val = store.getValue(nextState, (/** @type {?} */ (key)));
512
- }
513
- try {
514
- /** @type {?} */
515
- var newVal = (/** @type {?} */ (_this._options.beforeSerialize))(val, key);
516
- _this._engine.setItem((/** @type {?} */ (key)), (/** @type {?} */ (_this._options.serialize))(newVal));
517
- }
518
- catch (e) {
519
- // Caretaker note: we have still left the `typeof` condition in order to avoid
520
- // creating a breaking change for projects that still use the View Engine.
521
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
522
- console.error("Error ocurred while serializing the " + key + " store value, value not updated, the value obtained from the store: ", val);
523
- }
524
- }
525
- }
526
- }
527
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
528
- finally {
529
- try {
530
- if (keys_2_1 && !keys_2_1.done && (_a = keys_2.return)) _a.call(keys_2);
531
- }
532
- finally { if (e_2) throw e_2.error; }
533
- }
534
- }
535
- })));
536
- };
537
- NgxsStoragePlugin.decorators = [
538
- { type: core.Injectable }
539
- ];
540
- /** @nocollapse */
541
- NgxsStoragePlugin.ctorParameters = function () { return [
542
- { type: undefined, decorators: [{ type: core.Inject, args: [NGXS_STORAGE_PLUGIN_OPTIONS,] }] },
543
- { type: undefined, decorators: [{ type: core.Inject, args: [STORAGE_ENGINE,] }] },
544
- { type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
545
- ]; };
546
- return NgxsStoragePlugin;
547
- }());
548
- if (false) {
549
- /**
550
- * @type {?}
551
- * @private
552
- */
553
- NgxsStoragePlugin.prototype._options;
554
- /**
555
- * @type {?}
556
- * @private
557
- */
558
- NgxsStoragePlugin.prototype._engine;
559
- /**
560
- * @type {?}
561
- * @private
562
- */
563
- NgxsStoragePlugin.prototype._platformId;
391
+ /**
392
+ * @fileoverview added by tsickle
393
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
394
+ */
395
+ var NgxsStoragePlugin = /** @class */ (function () {
396
+ function NgxsStoragePlugin(_options, _engine, _platformId) {
397
+ this._options = _options;
398
+ this._engine = _engine;
399
+ this._platformId = _platformId;
400
+ }
401
+ /**
402
+ * @param {?} state
403
+ * @param {?} event
404
+ * @param {?} next
405
+ * @return {?}
406
+ */
407
+ NgxsStoragePlugin.prototype.handle = /**
408
+ * @param {?} state
409
+ * @param {?} event
410
+ * @param {?} next
411
+ * @return {?}
412
+ */
413
+ function (state, event, next) {
414
+ var _this = this;
415
+ var e_1, _a;
416
+ if (common.isPlatformServer(this._platformId) && this._engine === null) {
417
+ return next(state, event);
418
+ }
419
+ // We cast to `string[]` here as we're sure that this option has been
420
+ // transformed by the `storageOptionsFactory` function that provided token
421
+ /** @type {?} */
422
+ var keys = (/** @type {?} */ (this._options.key));
423
+ /** @type {?} */
424
+ var matches = store.actionMatcher(event);
425
+ /** @type {?} */
426
+ var isInitAction = matches(store.InitState);
427
+ /** @type {?} */
428
+ var isUpdateAction = matches(store.UpdateState);
429
+ /** @type {?} */
430
+ var isInitOrUpdateAction = isInitAction || isUpdateAction;
431
+ /** @type {?} */
432
+ var hasMigration = false;
433
+ if (isInitOrUpdateAction) {
434
+ var _loop_1 = function (key) {
435
+ // We're checking what states have been added by NGXS and if any of these states should be handled by
436
+ // the storage plugin. For instance, we only want to deserialize the `auth` state, NGXS has added
437
+ // the `user` state, the storage plugin will be rerun and will do redundant deserialization.
438
+ if (isUpdateAction && event.addedStates && !event.addedStates.hasOwnProperty(key)) {
439
+ return "continue";
440
+ }
441
+ /** @type {?} */
442
+ var isMaster = key === DEFAULT_STATE_KEY;
443
+ /** @type {?} */
444
+ var val = this_1._engine.getItem((/** @type {?} */ (key)));
445
+ if (val !== 'undefined' && val != null) {
446
+ try {
447
+ /** @type {?} */
448
+ var newVal = (/** @type {?} */ (this_1._options.deserialize))(val);
449
+ val = (/** @type {?} */ (this_1._options.afterDeserialize))(newVal, key);
450
+ }
451
+ catch (e) {
452
+ // Caretaker note: we have still left the `typeof` condition in order to avoid
453
+ // creating a breaking change for projects that still use the View Engine.
454
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
455
+ console.error("Error ocurred while deserializing the " + key + " store value, falling back to empty object, the value obtained from the store: ", val);
456
+ }
457
+ val = {};
458
+ }
459
+ if (this_1._options.migrations) {
460
+ this_1._options.migrations.forEach((/**
461
+ * @param {?} strategy
462
+ * @return {?}
463
+ */
464
+ function (strategy) {
465
+ /** @type {?} */
466
+ var versionMatch = strategy.version === store.getValue(val, strategy.versionKey || 'version');
467
+ /** @type {?} */
468
+ var keyMatch = (!strategy.key && isMaster) || strategy.key === key;
469
+ if (versionMatch && keyMatch) {
470
+ val = strategy.migrate(val);
471
+ hasMigration = true;
472
+ }
473
+ }));
474
+ }
475
+ if (!isMaster) {
476
+ state = store.setValue(state, (/** @type {?} */ (key)), val);
477
+ }
478
+ else {
479
+ state = __assign({}, state, val);
480
+ }
481
+ }
482
+ };
483
+ var this_1 = this;
484
+ try {
485
+ for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
486
+ var key = keys_1_1.value;
487
+ _loop_1(key);
488
+ }
489
+ }
490
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
491
+ finally {
492
+ try {
493
+ if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
494
+ }
495
+ finally { if (e_1) throw e_1.error; }
496
+ }
497
+ }
498
+ return next(state, event).pipe(operators.tap((/**
499
+ * @param {?} nextState
500
+ * @return {?}
501
+ */
502
+ function (nextState) {
503
+ var e_2, _a;
504
+ if (!isInitOrUpdateAction || (isInitOrUpdateAction && hasMigration)) {
505
+ try {
506
+ for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) {
507
+ var key = keys_2_1.value;
508
+ /** @type {?} */
509
+ var val = nextState;
510
+ if (key !== DEFAULT_STATE_KEY) {
511
+ val = store.getValue(nextState, (/** @type {?} */ (key)));
512
+ }
513
+ try {
514
+ /** @type {?} */
515
+ var newVal = (/** @type {?} */ (_this._options.beforeSerialize))(val, key);
516
+ _this._engine.setItem((/** @type {?} */ (key)), (/** @type {?} */ (_this._options.serialize))(newVal));
517
+ }
518
+ catch (e) {
519
+ // Caretaker note: we have still left the `typeof` condition in order to avoid
520
+ // creating a breaking change for projects that still use the View Engine.
521
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
522
+ console.error("Error ocurred while serializing the " + key + " store value, value not updated, the value obtained from the store: ", val);
523
+ }
524
+ }
525
+ }
526
+ }
527
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
528
+ finally {
529
+ try {
530
+ if (keys_2_1 && !keys_2_1.done && (_a = keys_2.return)) _a.call(keys_2);
531
+ }
532
+ finally { if (e_2) throw e_2.error; }
533
+ }
534
+ }
535
+ })));
536
+ };
537
+ NgxsStoragePlugin.decorators = [
538
+ { type: core.Injectable }
539
+ ];
540
+ /** @nocollapse */
541
+ NgxsStoragePlugin.ctorParameters = function () { return [
542
+ { type: undefined, decorators: [{ type: core.Inject, args: [NGXS_STORAGE_PLUGIN_OPTIONS,] }] },
543
+ { type: undefined, decorators: [{ type: core.Inject, args: [STORAGE_ENGINE,] }] },
544
+ { type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
545
+ ]; };
546
+ return NgxsStoragePlugin;
547
+ }());
548
+ if (false) {
549
+ /**
550
+ * @type {?}
551
+ * @private
552
+ */
553
+ NgxsStoragePlugin.prototype._options;
554
+ /**
555
+ * @type {?}
556
+ * @private
557
+ */
558
+ NgxsStoragePlugin.prototype._engine;
559
+ /**
560
+ * @type {?}
561
+ * @private
562
+ */
563
+ NgxsStoragePlugin.prototype._platformId;
564
564
  }
565
565
 
566
- /**
567
- * @fileoverview added by tsickle
568
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
569
- */
570
- /** @type {?} */
571
- var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
572
- var NgxsStoragePluginModule = /** @class */ (function () {
573
- function NgxsStoragePluginModule() {
574
- }
575
- /**
576
- * @param {?=} options
577
- * @return {?}
578
- */
579
- NgxsStoragePluginModule.forRoot = /**
580
- * @param {?=} options
581
- * @return {?}
582
- */
583
- function (options) {
584
- return {
585
- ngModule: NgxsStoragePluginModule,
586
- providers: [
587
- {
588
- provide: store.NGXS_PLUGINS,
589
- useClass: NgxsStoragePlugin,
590
- multi: true
591
- },
592
- {
593
- provide: USER_OPTIONS,
594
- useValue: options
595
- },
596
- {
597
- provide: NGXS_STORAGE_PLUGIN_OPTIONS,
598
- useFactory: storageOptionsFactory,
599
- deps: [USER_OPTIONS]
600
- },
601
- {
602
- provide: STORAGE_ENGINE,
603
- useFactory: engineFactory,
604
- deps: [NGXS_STORAGE_PLUGIN_OPTIONS, core.PLATFORM_ID]
605
- }
606
- ]
607
- };
608
- };
609
- NgxsStoragePluginModule.decorators = [
610
- { type: core.NgModule }
611
- ];
612
- return NgxsStoragePluginModule;
566
+ /**
567
+ * @fileoverview added by tsickle
568
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
569
+ */
570
+ /** @type {?} */
571
+ var USER_OPTIONS = new core.InjectionToken('USER_OPTIONS');
572
+ var NgxsStoragePluginModule = /** @class */ (function () {
573
+ function NgxsStoragePluginModule() {
574
+ }
575
+ /**
576
+ * @param {?=} options
577
+ * @return {?}
578
+ */
579
+ NgxsStoragePluginModule.forRoot = /**
580
+ * @param {?=} options
581
+ * @return {?}
582
+ */
583
+ function (options) {
584
+ return {
585
+ ngModule: NgxsStoragePluginModule,
586
+ providers: [
587
+ {
588
+ provide: store.NGXS_PLUGINS,
589
+ useClass: NgxsStoragePlugin,
590
+ multi: true
591
+ },
592
+ {
593
+ provide: USER_OPTIONS,
594
+ useValue: options
595
+ },
596
+ {
597
+ provide: NGXS_STORAGE_PLUGIN_OPTIONS,
598
+ useFactory: storageOptionsFactory,
599
+ deps: [USER_OPTIONS]
600
+ },
601
+ {
602
+ provide: STORAGE_ENGINE,
603
+ useFactory: engineFactory,
604
+ deps: [NGXS_STORAGE_PLUGIN_OPTIONS, core.PLATFORM_ID]
605
+ }
606
+ ]
607
+ };
608
+ };
609
+ NgxsStoragePluginModule.decorators = [
610
+ { type: core.NgModule }
611
+ ];
612
+ return NgxsStoragePluginModule;
613
613
  }());
614
614
 
615
615
  exports.NGXS_STORAGE_PLUGIN_OPTIONS = NGXS_STORAGE_PLUGIN_OPTIONS;