@ngxs/storage-plugin 3.8.2 → 18.0.0-dev.master-f4c2c19
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.
- package/esm2022/internals/index.mjs +3 -0
- package/esm2022/internals/ngxs-storage-plugin-internals.mjs +5 -0
- package/esm2022/internals/storage-key.mjs +20 -0
- package/esm2022/internals/symbols.mjs +16 -0
- package/{esm2015/src/engines.js → esm2022/src/engines.mjs} +2 -2
- package/esm2022/src/internals.mjs +31 -0
- package/esm2022/src/keys-manager.mjs +43 -0
- package/esm2022/src/public_api.mjs +6 -0
- package/esm2022/src/storage.module.mjs +61 -0
- package/esm2022/src/storage.plugin.mjs +146 -0
- package/esm2022/src/with-storage-feature.mjs +30 -0
- package/fesm2022/ngxs-storage-plugin-internals.mjs +43 -0
- package/fesm2022/ngxs-storage-plugin-internals.mjs.map +1 -0
- package/fesm2022/ngxs-storage-plugin.mjs +316 -0
- package/fesm2022/ngxs-storage-plugin.mjs.map +1 -0
- package/internals/index.d.ts +2 -0
- package/{src/internals → internals}/storage-key.d.ts +6 -6
- package/{src → internals}/symbols.d.ts +14 -4
- package/package.json +28 -14
- package/src/engines.d.ts +1 -1
- package/src/internals.d.ts +2 -7
- package/src/keys-manager.d.ts +18 -0
- package/src/public_api.d.ts +3 -2
- package/src/storage.module.d.ts +4 -4
- package/src/storage.plugin.d.ts +7 -5
- package/src/with-storage-feature.d.ts +3 -0
- package/bundles/ngxs-storage-plugin.umd.js +0 -794
- package/bundles/ngxs-storage-plugin.umd.js.map +0 -1
- package/esm2015/src/internals/final-options.js +0 -17
- package/esm2015/src/internals/storage-key.js +0 -21
- package/esm2015/src/internals.js +0 -27
- package/esm2015/src/public_api.js +0 -5
- package/esm2015/src/storage.module.js +0 -49
- package/esm2015/src/storage.plugin.js +0 -143
- package/esm2015/src/symbols.js +0 -5
- package/fesm2015/ngxs-storage-plugin.js +0 -268
- package/fesm2015/ngxs-storage-plugin.js.map +0 -1
- package/ngxs-storage-plugin.d.ts +0 -5
- package/src/internals/final-options.d.ts +0 -10
- /package/{esm2015/index.js → esm2022/index.mjs} +0 -0
- /package/{esm2015/ngxs-storage-plugin.js → esm2022/ngxs-storage-plugin.mjs} +0 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injector, Injectable, PLATFORM_ID, Inject, NgModule, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, InjectionToken } from '@angular/core';
|
|
3
|
+
import { withNgxsPlugin } from '@ngxs/store';
|
|
4
|
+
import { actionMatcher, InitState, UpdateState, getValue, setValue, NGXS_PLUGINS } from '@ngxs/store/plugins';
|
|
5
|
+
import { ɵDEFAULT_STATE_KEY as _DEFAULT_STATE_KEY, ɵNGXS_STORAGE_PLUGIN_OPTIONS as _NGXS_STORAGE_PLUGIN_OPTIONS, ɵextractStringKey as _extractStringKey, ɵisKeyWithExplicitEngine as _isKeyWithExplicitEngine, STORAGE_ENGINE, ɵALL_STATES_PERSISTED as _ALL_STATES_PERSISTED, ɵUSER_OPTIONS as _USER_OPTIONS } from '@ngxs/storage-plugin/internals';
|
|
6
|
+
export { STORAGE_ENGINE } from '@ngxs/storage-plugin/internals';
|
|
7
|
+
import { isPlatformServer, isPlatformBrowser } from '@angular/common';
|
|
8
|
+
import { tap } from 'rxjs/operators';
|
|
9
|
+
|
|
10
|
+
function storageOptionsFactory(options) {
|
|
11
|
+
return {
|
|
12
|
+
storage: 0 /* StorageOption.LocalStorage */,
|
|
13
|
+
serialize: JSON.stringify,
|
|
14
|
+
deserialize: JSON.parse,
|
|
15
|
+
beforeSerialize: obj => obj,
|
|
16
|
+
afterDeserialize: obj => obj,
|
|
17
|
+
...options,
|
|
18
|
+
keys: options.keys === '*' ? [_DEFAULT_STATE_KEY] : options.keys
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function engineFactory(options, platformId) {
|
|
22
|
+
if (isPlatformServer(platformId)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
if (options.storage === 0 /* StorageOption.LocalStorage */) {
|
|
26
|
+
return localStorage;
|
|
27
|
+
}
|
|
28
|
+
else if (options.storage === 1 /* StorageOption.SessionStorage */) {
|
|
29
|
+
return sessionStorage;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function getStorageKey(key, options) {
|
|
34
|
+
// Prepends the `namespace` option to any key if it's been provided by a user.
|
|
35
|
+
// So `@@STATE` becomes `my-app:@@STATE`.
|
|
36
|
+
return options?.namespace ? `${options.namespace}:${key}` : key;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class ɵNgxsStoragePluginKeysManager {
|
|
40
|
+
constructor() {
|
|
41
|
+
/** Store keys separately in a set so we're able to check if the key already exists. */
|
|
42
|
+
this._keys = new Set();
|
|
43
|
+
this._injector = inject(Injector);
|
|
44
|
+
this._keysWithEngines = [];
|
|
45
|
+
const { keys } = inject(_NGXS_STORAGE_PLUGIN_OPTIONS);
|
|
46
|
+
this.addKeys(keys);
|
|
47
|
+
}
|
|
48
|
+
getKeysWithEngines() {
|
|
49
|
+
// Spread to prevent external code from directly modifying the internal state.
|
|
50
|
+
return [...this._keysWithEngines];
|
|
51
|
+
}
|
|
52
|
+
addKeys(storageKeys) {
|
|
53
|
+
for (const storageKey of storageKeys) {
|
|
54
|
+
const key = _extractStringKey(storageKey);
|
|
55
|
+
// The user may call `withStorageFeature` with the same state multiple times.
|
|
56
|
+
// Let's prevent duplicating state names in the `keysWithEngines` list.
|
|
57
|
+
// Please note that calling provideStates multiple times with the same state is
|
|
58
|
+
// acceptable behavior. This may occur because the state could be necessary at the
|
|
59
|
+
// feature level, and different parts of the application might require its registration.
|
|
60
|
+
// Consequently, `withStorageFeature` may also be called multiple times.
|
|
61
|
+
if (this._keys.has(key)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
this._keys.add(key);
|
|
65
|
+
const engine = _isKeyWithExplicitEngine(storageKey)
|
|
66
|
+
? this._injector.get(storageKey.engine)
|
|
67
|
+
: this._injector.get(STORAGE_ENGINE);
|
|
68
|
+
this._keysWithEngines.push({ key, engine });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ɵNgxsStoragePluginKeysManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
72
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ɵNgxsStoragePluginKeysManager, providedIn: 'root' }); }
|
|
73
|
+
}
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ɵNgxsStoragePluginKeysManager, decorators: [{
|
|
75
|
+
type: Injectable,
|
|
76
|
+
args: [{ providedIn: 'root' }]
|
|
77
|
+
}], ctorParameters: () => [] });
|
|
78
|
+
|
|
79
|
+
const NG_DEV_MODE$2 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
80
|
+
class NgxsStoragePlugin {
|
|
81
|
+
constructor(_keysManager, _options, _platformId) {
|
|
82
|
+
this._keysManager = _keysManager;
|
|
83
|
+
this._options = _options;
|
|
84
|
+
this._platformId = _platformId;
|
|
85
|
+
this._allStatesPersisted = inject(_ALL_STATES_PERSISTED);
|
|
86
|
+
}
|
|
87
|
+
handle(state, event, next) {
|
|
88
|
+
if (isPlatformServer(this._platformId)) {
|
|
89
|
+
return next(state, event);
|
|
90
|
+
}
|
|
91
|
+
const matches = actionMatcher(event);
|
|
92
|
+
const isInitAction = matches(InitState);
|
|
93
|
+
const isUpdateAction = matches(UpdateState);
|
|
94
|
+
const isInitOrUpdateAction = isInitAction || isUpdateAction;
|
|
95
|
+
let hasMigration = false;
|
|
96
|
+
if (isInitOrUpdateAction) {
|
|
97
|
+
const addedStates = isUpdateAction && event.addedStates;
|
|
98
|
+
for (const { key, engine } of this._keysManager.getKeysWithEngines()) {
|
|
99
|
+
// We're checking what states have been added by NGXS and if any of these states should be handled by
|
|
100
|
+
// the storage plugin. For instance, we only want to deserialize the `auth` state, NGXS has added
|
|
101
|
+
// the `user` state, the storage plugin will be rerun and will do redundant deserialization.
|
|
102
|
+
// `usesDefaultStateKey` is necessary to check since `event.addedStates` never contains `@@STATE`.
|
|
103
|
+
if (!this._allStatesPersisted && addedStates) {
|
|
104
|
+
// We support providing keys that can be deeply nested via dot notation, for instance,
|
|
105
|
+
// `keys: ['myState.myProperty']` is a valid key.
|
|
106
|
+
// The state name should always go first. The below code checks if the `key` includes dot
|
|
107
|
+
// notation and extracts the state name out of the key.
|
|
108
|
+
// Given the `key` is `myState.myProperty`, the `addedStates` will only contain `myState`.
|
|
109
|
+
const dotNotationIndex = key.indexOf(DOT);
|
|
110
|
+
const stateName = dotNotationIndex > -1 ? key.slice(0, dotNotationIndex) : key;
|
|
111
|
+
if (!addedStates.hasOwnProperty(stateName)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const storageKey = getStorageKey(key, this._options);
|
|
116
|
+
let storedValue = engine.getItem(storageKey);
|
|
117
|
+
if (storedValue !== 'undefined' && storedValue != null) {
|
|
118
|
+
try {
|
|
119
|
+
const newVal = this._options.deserialize(storedValue);
|
|
120
|
+
storedValue = this._options.afterDeserialize(newVal, key);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
NG_DEV_MODE$2 &&
|
|
124
|
+
console.error(`Error ocurred while deserializing the ${storageKey} store value, falling back to empty object, the value obtained from the store: `, storedValue);
|
|
125
|
+
storedValue = {};
|
|
126
|
+
}
|
|
127
|
+
this._options.migrations?.forEach(strategy => {
|
|
128
|
+
const versionMatch = strategy.version === getValue(storedValue, strategy.versionKey || 'version');
|
|
129
|
+
const keyMatch = (!strategy.key && this._allStatesPersisted) || strategy.key === key;
|
|
130
|
+
if (versionMatch && keyMatch) {
|
|
131
|
+
storedValue = strategy.migrate(storedValue);
|
|
132
|
+
hasMigration = true;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (this._allStatesPersisted) {
|
|
136
|
+
storedValue = this._hydrateSelectivelyOnUpdate(storedValue, addedStates);
|
|
137
|
+
state = { ...state, ...storedValue };
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
state = setValue(state, key, storedValue);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return next(state, event).pipe(tap(nextState => {
|
|
146
|
+
if (isInitOrUpdateAction && !hasMigration) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
for (const { key, engine } of this._keysManager.getKeysWithEngines()) {
|
|
150
|
+
let storedValue = nextState;
|
|
151
|
+
const storageKey = getStorageKey(key, this._options);
|
|
152
|
+
if (key !== _DEFAULT_STATE_KEY) {
|
|
153
|
+
storedValue = getValue(nextState, key);
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const newStoredValue = this._options.beforeSerialize(storedValue, key);
|
|
157
|
+
engine.setItem(storageKey, this._options.serialize(newStoredValue));
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (NG_DEV_MODE$2) {
|
|
161
|
+
if (error &&
|
|
162
|
+
(error.name === 'QuotaExceededError' ||
|
|
163
|
+
error.name === 'NS_ERROR_DOM_QUOTA_REACHED')) {
|
|
164
|
+
console.error(`The ${storageKey} store value exceeds the browser storage quota: `, storedValue);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.error(`Error ocurred while serializing the ${storageKey} store value, value not updated, the value obtained from the store: `, storedValue);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
_hydrateSelectivelyOnUpdate(storedValue, addedStates) {
|
|
175
|
+
// The `UpdateState` action is triggered whenever a feature state is added.
|
|
176
|
+
// The condition below is only satisfied when this action is triggered.
|
|
177
|
+
// Let's consider two states: `counter` and `@ngxs/router-plugin` state.
|
|
178
|
+
// When `provideStore` is called, `CounterState` is provided at the root level,
|
|
179
|
+
// while `@ngxs/router-plugin` is provided as a feature state. Previously, the storage
|
|
180
|
+
// plugin might have stored the value of the counter state as `10`. If `CounterState`
|
|
181
|
+
// implements the `ngxsOnInit` hook and sets the state to `999`, the storage plugin will
|
|
182
|
+
// reset the entire state when the `RouterState` is registered.
|
|
183
|
+
// Consequently, the `counter` state will revert back to `10` instead of `999`.
|
|
184
|
+
if (!storedValue || !addedStates || Object.keys(addedStates).length === 0) {
|
|
185
|
+
// Nothing to update if `addedStates` object is empty.
|
|
186
|
+
return storedValue;
|
|
187
|
+
}
|
|
188
|
+
// The `storedValue` can be the entire state when the default state key
|
|
189
|
+
// is used. However, if `addedStates` only contains the `router` value,
|
|
190
|
+
// we only want to merge the state with that `router` value.
|
|
191
|
+
// Given the `storedValue` is an object:
|
|
192
|
+
// `{ counter: 10, router: {...} }`
|
|
193
|
+
// This will only select the `router` object from the `storedValue`,
|
|
194
|
+
// avoiding unnecessary rehydration of the `counter` state.
|
|
195
|
+
return Object.keys(addedStates).reduce((accumulator, addedState) => {
|
|
196
|
+
if (storedValue.hasOwnProperty(addedState)) {
|
|
197
|
+
accumulator[addedState] = storedValue[addedState];
|
|
198
|
+
}
|
|
199
|
+
return accumulator;
|
|
200
|
+
}, {});
|
|
201
|
+
}
|
|
202
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePlugin, deps: [{ token: ɵNgxsStoragePluginKeysManager }, { token: _NGXS_STORAGE_PLUGIN_OPTIONS }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
203
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePlugin }); }
|
|
204
|
+
}
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePlugin, decorators: [{
|
|
206
|
+
type: Injectable
|
|
207
|
+
}], ctorParameters: () => [{ type: ɵNgxsStoragePluginKeysManager }, { type: undefined, decorators: [{
|
|
208
|
+
type: Inject,
|
|
209
|
+
args: [_NGXS_STORAGE_PLUGIN_OPTIONS]
|
|
210
|
+
}] }, { type: undefined, decorators: [{
|
|
211
|
+
type: Inject,
|
|
212
|
+
args: [PLATFORM_ID]
|
|
213
|
+
}] }] });
|
|
214
|
+
const DOT = '.';
|
|
215
|
+
|
|
216
|
+
class NgxsStoragePluginModule {
|
|
217
|
+
static forRoot(options) {
|
|
218
|
+
return {
|
|
219
|
+
ngModule: NgxsStoragePluginModule,
|
|
220
|
+
providers: [
|
|
221
|
+
{
|
|
222
|
+
provide: NGXS_PLUGINS,
|
|
223
|
+
useClass: NgxsStoragePlugin,
|
|
224
|
+
multi: true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
provide: _USER_OPTIONS,
|
|
228
|
+
useValue: options
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
provide: _NGXS_STORAGE_PLUGIN_OPTIONS,
|
|
232
|
+
useFactory: storageOptionsFactory,
|
|
233
|
+
deps: [_USER_OPTIONS]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
provide: STORAGE_ENGINE,
|
|
237
|
+
useFactory: engineFactory,
|
|
238
|
+
deps: [_NGXS_STORAGE_PLUGIN_OPTIONS, PLATFORM_ID]
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
244
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePluginModule }); }
|
|
245
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePluginModule }); }
|
|
246
|
+
}
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: NgxsStoragePluginModule, decorators: [{
|
|
248
|
+
type: NgModule
|
|
249
|
+
}] });
|
|
250
|
+
function withNgxsStoragePlugin(options) {
|
|
251
|
+
return makeEnvironmentProviders([
|
|
252
|
+
withNgxsPlugin(NgxsStoragePlugin),
|
|
253
|
+
{
|
|
254
|
+
provide: _USER_OPTIONS,
|
|
255
|
+
useValue: options
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
provide: _NGXS_STORAGE_PLUGIN_OPTIONS,
|
|
259
|
+
useFactory: storageOptionsFactory,
|
|
260
|
+
deps: [_USER_OPTIONS]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
provide: STORAGE_ENGINE,
|
|
264
|
+
useFactory: engineFactory,
|
|
265
|
+
deps: [_NGXS_STORAGE_PLUGIN_OPTIONS, PLATFORM_ID]
|
|
266
|
+
}
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const NG_DEV_MODE$1 = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
271
|
+
function withStorageFeature(storageKeys) {
|
|
272
|
+
return makeEnvironmentProviders([
|
|
273
|
+
{
|
|
274
|
+
provide: ENVIRONMENT_INITIALIZER,
|
|
275
|
+
multi: true,
|
|
276
|
+
useValue: () => {
|
|
277
|
+
const allStatesPersisted = inject(_ALL_STATES_PERSISTED);
|
|
278
|
+
if (allStatesPersisted) {
|
|
279
|
+
if (NG_DEV_MODE$1) {
|
|
280
|
+
const message = 'The NGXS storage plugin is currently persisting all states because the `keys` ' +
|
|
281
|
+
'option was explicitly set to `*` at the root level. To selectively persist states, ' +
|
|
282
|
+
'consider explicitly specifying them, allowing for addition at the feature level.';
|
|
283
|
+
console.error(message);
|
|
284
|
+
}
|
|
285
|
+
// We should prevent the addition of any feature states to persistence
|
|
286
|
+
// if the `keys` property is set to `*`, as this could disrupt the algorithm
|
|
287
|
+
// used in the storage plugin. Instead, we should log an error in development
|
|
288
|
+
// mode. In production, it should continue to function, but act as a no-op.
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
inject(ɵNgxsStoragePluginKeysManager).addKeys(storageKeys);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
]);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;
|
|
298
|
+
const LOCAL_STORAGE_ENGINE = new InjectionToken(NG_DEV_MODE ? 'LOCAL_STORAGE_ENGINE' : '', {
|
|
299
|
+
providedIn: 'root',
|
|
300
|
+
factory: () => (isPlatformBrowser(inject(PLATFORM_ID)) ? localStorage : null)
|
|
301
|
+
});
|
|
302
|
+
const SESSION_STORAGE_ENGINE = new InjectionToken(NG_DEV_MODE ? 'SESSION_STORAGE_ENGINE' : '', {
|
|
303
|
+
providedIn: 'root',
|
|
304
|
+
factory: () => (isPlatformBrowser(inject(PLATFORM_ID)) ? sessionStorage : null)
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* The public api for consumers of @ngxs/storage-plugin
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Generated bundle index. Do not edit.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
export { LOCAL_STORAGE_ENGINE, NgxsStoragePlugin, NgxsStoragePluginModule, SESSION_STORAGE_ENGINE, withNgxsStoragePlugin, withStorageFeature };
|
|
316
|
+
//# sourceMappingURL=ngxs-storage-plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngxs-storage-plugin.mjs","sources":["../../../packages/storage-plugin/src/internals.ts","../../../packages/storage-plugin/src/keys-manager.ts","../../../packages/storage-plugin/src/storage.plugin.ts","../../../packages/storage-plugin/src/storage.module.ts","../../../packages/storage-plugin/src/with-storage-feature.ts","../../../packages/storage-plugin/src/engines.ts","../../../packages/storage-plugin/index.ts","../../../packages/storage-plugin/ngxs-storage-plugin.ts"],"sourcesContent":["import { isPlatformServer } from '@angular/common';\nimport {\n ɵDEFAULT_STATE_KEY,\n StorageOption,\n StorageEngine,\n NgxsStoragePluginOptions,\n ɵNgxsTransformedStoragePluginOptions\n} from '@ngxs/storage-plugin/internals';\n\nexport function storageOptionsFactory(\n options: NgxsStoragePluginOptions\n): ɵNgxsTransformedStoragePluginOptions {\n return {\n storage: StorageOption.LocalStorage,\n serialize: JSON.stringify,\n deserialize: JSON.parse,\n beforeSerialize: obj => obj,\n afterDeserialize: obj => obj,\n ...options,\n keys: options.keys === '*' ? [ɵDEFAULT_STATE_KEY] : options.keys\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\nexport function getStorageKey(key: string, options?: NgxsStoragePluginOptions): string {\n // Prepends the `namespace` option to any key if it's been provided by a user.\n // So `@@STATE` becomes `my-app:@@STATE`.\n return options?.namespace ? `${options.namespace}:${key}` : key;\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport {\n STORAGE_ENGINE,\n StorageEngine,\n StorageKey,\n ɵextractStringKey,\n ɵisKeyWithExplicitEngine,\n ɵNGXS_STORAGE_PLUGIN_OPTIONS\n} from '@ngxs/storage-plugin/internals';\n\ninterface KeyWithEngine {\n key: string;\n engine: StorageEngine;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ɵNgxsStoragePluginKeysManager {\n /** Store keys separately in a set so we're able to check if the key already exists. */\n private readonly _keys = new Set<string>();\n\n private readonly _injector = inject(Injector);\n\n private readonly _keysWithEngines: KeyWithEngine[] = [];\n\n constructor() {\n const { keys } = inject(ɵNGXS_STORAGE_PLUGIN_OPTIONS);\n this.addKeys(keys);\n }\n\n getKeysWithEngines() {\n // Spread to prevent external code from directly modifying the internal state.\n return [...this._keysWithEngines];\n }\n\n addKeys(storageKeys: StorageKey[]): void {\n for (const storageKey of storageKeys) {\n const key = ɵextractStringKey(storageKey);\n\n // The user may call `withStorageFeature` with the same state multiple times.\n // Let's prevent duplicating state names in the `keysWithEngines` list.\n // Please note that calling provideStates multiple times with the same state is\n // acceptable behavior. This may occur because the state could be necessary at the\n // feature level, and different parts of the application might require its registration.\n // Consequently, `withStorageFeature` may also be called multiple times.\n if (this._keys.has(key)) {\n continue;\n }\n\n this._keys.add(key);\n\n const engine = ɵisKeyWithExplicitEngine(storageKey)\n ? this._injector.get(storageKey.engine)\n : this._injector.get(STORAGE_ENGINE);\n\n this._keysWithEngines.push({ key, engine });\n }\n }\n}\n","import { PLATFORM_ID, Inject, Injectable, inject } 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/plugins';\nimport {\n ɵDEFAULT_STATE_KEY,\n ɵALL_STATES_PERSISTED,\n NgxsStoragePluginOptions,\n ɵNGXS_STORAGE_PLUGIN_OPTIONS\n} from '@ngxs/storage-plugin/internals';\nimport { tap } from 'rxjs/operators';\n\nimport { getStorageKey } from './internals';\nimport { ɵNgxsStoragePluginKeysManager } from './keys-manager';\n\ndeclare const ngDevMode: boolean;\n\nconst NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;\n\n@Injectable()\nexport class NgxsStoragePlugin implements NgxsPlugin {\n private _allStatesPersisted = inject(ɵALL_STATES_PERSISTED);\n\n constructor(\n private _keysManager: ɵNgxsStoragePluginKeysManager,\n @Inject(ɵNGXS_STORAGE_PLUGIN_OPTIONS) private _options: NgxsStoragePluginOptions,\n @Inject(PLATFORM_ID) private _platformId: string\n ) {}\n\n handle(state: any, event: any, next: NgxsNextPluginFn) {\n if (isPlatformServer(this._platformId)) {\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: ɵPlainObject = isUpdateAction && event.addedStates;\n\n for (const { key, engine } of this._keysManager.getKeysWithEngines()) {\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._allStatesPersisted && 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 const storageKey = getStorageKey(key, this._options);\n let storedValue: any = engine.getItem(storageKey);\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 NG_DEV_MODE &&\n console.error(\n `Error ocurred while deserializing the ${storageKey} store value, falling back to empty object, the value obtained from the store: `,\n storedValue\n );\n\n storedValue = {};\n }\n\n this._options.migrations?.forEach(strategy => {\n const versionMatch =\n strategy.version === getValue(storedValue, strategy.versionKey || 'version');\n const keyMatch =\n (!strategy.key && this._allStatesPersisted) || strategy.key === key;\n if (versionMatch && keyMatch) {\n storedValue = strategy.migrate(storedValue);\n hasMigration = true;\n }\n });\n\n if (this._allStatesPersisted) {\n storedValue = this._hydrateSelectivelyOnUpdate(storedValue, addedStates);\n state = { ...state, ...storedValue };\n } else {\n state = setValue(state, key, storedValue);\n }\n }\n }\n }\n\n return next(state, event).pipe(\n tap(nextState => {\n if (isInitOrUpdateAction && !hasMigration) {\n return;\n }\n\n for (const { key, engine } of this._keysManager.getKeysWithEngines()) {\n let storedValue = nextState;\n\n const storageKey = getStorageKey(key, this._options);\n\n if (key !== ɵDEFAULT_STATE_KEY) {\n storedValue = getValue(nextState, key);\n }\n\n try {\n const newStoredValue = this._options.beforeSerialize!(storedValue, key);\n engine.setItem(storageKey, this._options.serialize!(newStoredValue));\n } catch (error: any) {\n if (NG_DEV_MODE) {\n if (\n error &&\n (error.name === 'QuotaExceededError' ||\n error.name === 'NS_ERROR_DOM_QUOTA_REACHED')\n ) {\n console.error(\n `The ${storageKey} store value exceeds the browser storage quota: `,\n storedValue\n );\n } else {\n console.error(\n `Error ocurred while serializing the ${storageKey} store value, value not updated, the value obtained from the store: `,\n storedValue\n );\n }\n }\n }\n }\n })\n );\n }\n\n private _hydrateSelectivelyOnUpdate(storedValue: any, addedStates: ɵPlainObject) {\n // The `UpdateState` action is triggered whenever a feature state is added.\n // The condition below is only satisfied when this action is triggered.\n // Let's consider two states: `counter` and `@ngxs/router-plugin` state.\n // When `provideStore` is called, `CounterState` is provided at the root level,\n // while `@ngxs/router-plugin` is provided as a feature state. Previously, the storage\n // plugin might have stored the value of the counter state as `10`. If `CounterState`\n // implements the `ngxsOnInit` hook and sets the state to `999`, the storage plugin will\n // reset the entire state when the `RouterState` is registered.\n // Consequently, the `counter` state will revert back to `10` instead of `999`.\n\n if (!storedValue || !addedStates || Object.keys(addedStates).length === 0) {\n // Nothing to update if `addedStates` object is empty.\n return storedValue;\n }\n\n // The `storedValue` can be the entire state when the default state key\n // is used. However, if `addedStates` only contains the `router` value,\n // we only want to merge the state with that `router` value.\n // Given the `storedValue` is an object:\n // `{ counter: 10, router: {...} }`\n // This will only select the `router` object from the `storedValue`,\n // avoiding unnecessary rehydration of the `counter` state.\n return Object.keys(addedStates).reduce(\n (accumulator, addedState) => {\n if (storedValue.hasOwnProperty(addedState)) {\n accumulator[addedState] = storedValue[addedState];\n }\n return accumulator;\n },\n <ɵPlainObject>{}\n );\n }\n}\n\nconst DOT = '.';\n","import {\n NgModule,\n ModuleWithProviders,\n PLATFORM_ID,\n EnvironmentProviders,\n makeEnvironmentProviders\n} from '@angular/core';\nimport { withNgxsPlugin } from '@ngxs/store';\nimport { NGXS_PLUGINS } from '@ngxs/store/plugins';\nimport {\n ɵUSER_OPTIONS,\n STORAGE_ENGINE,\n ɵNGXS_STORAGE_PLUGIN_OPTIONS,\n NgxsStoragePluginOptions\n} from '@ngxs/storage-plugin/internals';\n\nimport { NgxsStoragePlugin } from './storage.plugin';\nimport { engineFactory, storageOptionsFactory } from './internals';\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\nexport function withNgxsStoragePlugin(\n options: NgxsStoragePluginOptions\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n withNgxsPlugin(NgxsStoragePlugin),\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","import {\n inject,\n EnvironmentProviders,\n ENVIRONMENT_INITIALIZER,\n makeEnvironmentProviders\n} from '@angular/core';\nimport { StorageKey, ɵALL_STATES_PERSISTED } from '@ngxs/storage-plugin/internals';\n\nimport { ɵNgxsStoragePluginKeysManager } from './keys-manager';\n\ndeclare const ngDevMode: boolean;\n\nconst NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;\n\nexport function withStorageFeature(storageKeys: StorageKey[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => {\n const allStatesPersisted = inject(ɵALL_STATES_PERSISTED);\n\n if (allStatesPersisted) {\n if (NG_DEV_MODE) {\n const message =\n 'The NGXS storage plugin is currently persisting all states because the `keys` ' +\n 'option was explicitly set to `*` at the root level. To selectively persist states, ' +\n 'consider explicitly specifying them, allowing for addition at the feature level.';\n\n console.error(message);\n }\n\n // We should prevent the addition of any feature states to persistence\n // if the `keys` property is set to `*`, as this could disrupt the algorithm\n // used in the storage plugin. Instead, we should log an error in development\n // mode. In production, it should continue to function, but act as a no-op.\n return;\n }\n\n inject(ɵNgxsStoragePluginKeysManager).addKeys(storageKeys);\n }\n }\n ]);\n}\n","import { InjectionToken, PLATFORM_ID, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { StorageEngine } from '@ngxs/storage-plugin/internals';\n\ndeclare const ngDevMode: boolean;\n\nconst NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;\n\nexport const LOCAL_STORAGE_ENGINE = new InjectionToken<StorageEngine | null>(\n NG_DEV_MODE ? 'LOCAL_STORAGE_ENGINE' : '',\n {\n providedIn: 'root',\n factory: () => (isPlatformBrowser(inject(PLATFORM_ID)) ? localStorage : null)\n }\n);\n\nexport const SESSION_STORAGE_ENGINE = new InjectionToken<StorageEngine | null>(\n NG_DEV_MODE ? 'SESSION_STORAGE_ENGINE' : '',\n {\n providedIn: 'root',\n factory: () => (isPlatformBrowser(inject(PLATFORM_ID)) ? sessionStorage : null)\n }\n);\n","/**\n * The public api for consumers of @ngxs/storage-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵDEFAULT_STATE_KEY","ɵNGXS_STORAGE_PLUGIN_OPTIONS","ɵextractStringKey","ɵisKeyWithExplicitEngine","NG_DEV_MODE","ɵALL_STATES_PERSISTED","i1.ɵNgxsStoragePluginKeysManager","ɵUSER_OPTIONS"],"mappings":";;;;;;;;;AASM,SAAU,qBAAqB,CACnC,OAAiC,EAAA;IAEjC,OAAO;AACL,QAAA,OAAO,EAA4B,CAAA;QACnC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,KAAK;AACvB,QAAA,eAAe,EAAE,GAAG,IAAI,GAAG;AAC3B,QAAA,gBAAgB,EAAE,GAAG,IAAI,GAAG;AAC5B,QAAA,GAAG,OAAO;AACV,QAAA,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,GAAG,GAAG,CAACA,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI;KACjE,CAAC;AACJ,CAAC;AAEe,SAAA,aAAa,CAC3B,OAAiC,EACjC,UAAkB,EAAA;AAElB,IAAA,IAAI,gBAAgB,CAAC,UAAU,CAAC,EAAE;AAChC,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,IAAI,OAAO,CAAC,OAAO,KAAA,CAAA,mCAAiC;AAClD,QAAA,OAAO,YAAY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A6B,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aAC5D;AACF,SAAA;AACF,KAAA,CAAC,CAAC;AACL;;ACrCA,MAAM,WAAW,GAAG,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC;AAErD,MAAA,oBAAoB,GAAG,IAAI,cAAc,CACpD,WAAW,GAAG,sBAAsB,GAAG,EAAE,EACzC;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC;AAC9E,CAAA,EACD;AAEW,MAAA,sBAAsB,GAAG,IAAI,cAAc,CACtD,WAAW,GAAG,wBAAwB,GAAG,EAAE,EAC3C;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC;AAChF,CAAA;;ACrBH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { InjectionToken, Type } from '@angular/core';
|
|
2
2
|
import { StateToken } from '@ngxs/store';
|
|
3
|
-
import {
|
|
4
|
-
import { StorageEngine } from '
|
|
3
|
+
import { ɵStateClass } from '@ngxs/store/internals';
|
|
4
|
+
import { StorageEngine } from './symbols';
|
|
5
5
|
/** This enables the user to provide a storage engine per individual key. */
|
|
6
6
|
export interface KeyWithExplicitEngine {
|
|
7
|
-
key: string |
|
|
7
|
+
key: string | ɵStateClass | StateToken<any>;
|
|
8
8
|
engine: Type<StorageEngine> | InjectionToken<StorageEngine>;
|
|
9
9
|
}
|
|
10
10
|
/** Determines whether the provided key has the following structure. */
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function ɵisKeyWithExplicitEngine(key: any): key is KeyWithExplicitEngine;
|
|
12
12
|
/**
|
|
13
13
|
* This tuples all of the possible types allowed in the `key` property.
|
|
14
14
|
* This is not exposed publicly and used internally only.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
17
|
-
export declare function
|
|
16
|
+
export type StorageKey = string | ɵStateClass | StateToken<any> | KeyWithExplicitEngine;
|
|
17
|
+
export declare function ɵextractStringKey(storageKey: StorageKey): string;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { StorageKey } from './
|
|
2
|
+
import { StorageKey } from './storage-key';
|
|
3
|
+
/**
|
|
4
|
+
* The following key is used to store the entire serialized
|
|
5
|
+
* state when no specific state is provided.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ɵDEFAULT_STATE_KEY = "@@STATE";
|
|
3
8
|
export declare const enum StorageOption {
|
|
4
9
|
LocalStorage = 0,
|
|
5
10
|
SessionStorage = 1
|
|
6
11
|
}
|
|
7
12
|
export interface NgxsStoragePluginOptions {
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
* Keys for the state slice to store in the storage engine.
|
|
10
15
|
*/
|
|
11
|
-
|
|
16
|
+
keys: '*' | StorageKey[];
|
|
12
17
|
/**
|
|
13
18
|
* The namespace is used to prefix the key for the state slice. This is
|
|
14
19
|
* necessary when running micro frontend applications which use storage plugin.
|
|
@@ -59,7 +64,12 @@ export interface NgxsStoragePluginOptions {
|
|
|
59
64
|
*/
|
|
60
65
|
afterDeserialize?(obj: any, key: string): any;
|
|
61
66
|
}
|
|
62
|
-
export
|
|
67
|
+
export interface ɵNgxsTransformedStoragePluginOptions extends NgxsStoragePluginOptions {
|
|
68
|
+
keys: StorageKey[];
|
|
69
|
+
}
|
|
70
|
+
export declare const ɵUSER_OPTIONS: InjectionToken<NgxsStoragePluginOptions>;
|
|
71
|
+
export declare const ɵALL_STATES_PERSISTED: InjectionToken<boolean>;
|
|
72
|
+
export declare const ɵNGXS_STORAGE_PLUGIN_OPTIONS: InjectionToken<ɵNgxsTransformedStoragePluginOptions>;
|
|
63
73
|
export declare const STORAGE_ENGINE: InjectionToken<StorageEngine>;
|
|
64
74
|
export interface StorageEngine {
|
|
65
75
|
getItem(key: string): any;
|
package/package.json
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/package.schema.json",
|
|
3
2
|
"name": "@ngxs/storage-plugin",
|
|
4
3
|
"description": "extendable storage plugin for @ngxs/store",
|
|
5
|
-
"version": "
|
|
6
|
-
"sideEffects":
|
|
4
|
+
"version": "18.0.0-dev.master-f4c2c19",
|
|
5
|
+
"sideEffects": false,
|
|
7
6
|
"peerDependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
10
|
-
"rxjs": ">=6.5.5"
|
|
7
|
+
"@angular/core": ">=16.0.0 <19.0.0",
|
|
8
|
+
"@ngxs/store": "^18.0.0 || ^18.0.0-dev",
|
|
9
|
+
"rxjs": ">=6.5.5",
|
|
10
|
+
"ts-morph": "21.0.1"
|
|
11
|
+
},
|
|
12
|
+
"schematics": "./schematics/collection.json",
|
|
13
|
+
"module": "fesm2022/ngxs-storage-plugin.mjs",
|
|
14
|
+
"typings": "index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"esm2022": "./esm2022/ngxs-storage-plugin.mjs",
|
|
22
|
+
"esm": "./esm2022/ngxs-storage-plugin.mjs",
|
|
23
|
+
"default": "./fesm2022/ngxs-storage-plugin.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./internals": {
|
|
26
|
+
"types": "./internals/index.d.ts",
|
|
27
|
+
"esm2022": "./esm2022/internals/ngxs-storage-plugin-internals.mjs",
|
|
28
|
+
"esm": "./esm2022/internals/ngxs-storage-plugin-internals.mjs",
|
|
29
|
+
"default": "./fesm2022/ngxs-storage-plugin-internals.mjs"
|
|
30
|
+
}
|
|
11
31
|
},
|
|
12
|
-
"main": "bundles/ngxs-storage-plugin.umd.js",
|
|
13
|
-
"module": "fesm2015/ngxs-storage-plugin.js",
|
|
14
|
-
"es2015": "fesm2015/ngxs-storage-plugin.js",
|
|
15
|
-
"esm2015": "esm2015/ngxs-storage-plugin.js",
|
|
16
|
-
"fesm2015": "fesm2015/ngxs-storage-plugin.js",
|
|
17
|
-
"typings": "ngxs-storage-plugin.d.ts",
|
|
18
32
|
"dependencies": {
|
|
19
|
-
"tslib": "^2.
|
|
33
|
+
"tslib": "^2.3.0"
|
|
20
34
|
},
|
|
21
35
|
"repository": {
|
|
22
36
|
"type": "git",
|
|
@@ -62,4 +76,4 @@
|
|
|
62
76
|
"type": "opencollective",
|
|
63
77
|
"url": "https://opencollective.com/ngxs"
|
|
64
78
|
}
|
|
65
|
-
}
|
|
79
|
+
}
|
package/src/engines.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { StorageEngine } from '
|
|
2
|
+
import { StorageEngine } from '@ngxs/storage-plugin/internals';
|
|
3
3
|
export declare const LOCAL_STORAGE_ENGINE: InjectionToken<StorageEngine | null>;
|
|
4
4
|
export declare const SESSION_STORAGE_ENGINE: InjectionToken<StorageEngine | null>;
|
package/src/internals.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { StorageEngine, NgxsStoragePluginOptions } from '
|
|
2
|
-
|
|
3
|
-
* The following key is used to store the entire serialized
|
|
4
|
-
* state when there's no specific state provided.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DEFAULT_STATE_KEY = "@@STATE";
|
|
7
|
-
export declare function storageOptionsFactory(options: NgxsStoragePluginOptions | undefined): NgxsStoragePluginOptions;
|
|
1
|
+
import { StorageEngine, NgxsStoragePluginOptions, ɵNgxsTransformedStoragePluginOptions } from '@ngxs/storage-plugin/internals';
|
|
2
|
+
export declare function storageOptionsFactory(options: NgxsStoragePluginOptions): ɵNgxsTransformedStoragePluginOptions;
|
|
8
3
|
export declare function engineFactory(options: NgxsStoragePluginOptions, platformId: string): StorageEngine | null;
|
|
9
4
|
export declare function getStorageKey(key: string, options?: NgxsStoragePluginOptions): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StorageEngine, StorageKey } from '@ngxs/storage-plugin/internals';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
interface KeyWithEngine {
|
|
4
|
+
key: string;
|
|
5
|
+
engine: StorageEngine;
|
|
6
|
+
}
|
|
7
|
+
export declare class ɵNgxsStoragePluginKeysManager {
|
|
8
|
+
/** Store keys separately in a set so we're able to check if the key already exists. */
|
|
9
|
+
private readonly _keys;
|
|
10
|
+
private readonly _injector;
|
|
11
|
+
private readonly _keysWithEngines;
|
|
12
|
+
constructor();
|
|
13
|
+
getKeysWithEngines(): KeyWithEngine[];
|
|
14
|
+
addKeys(storageKeys: StorageKey[]): void;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgxsStoragePluginKeysManager, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsStoragePluginKeysManager>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/src/public_api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { NgxsStoragePluginModule } from './storage.module';
|
|
1
|
+
export { NgxsStoragePluginModule, withNgxsStoragePlugin } from './storage.module';
|
|
2
|
+
export { withStorageFeature } from './with-storage-feature';
|
|
2
3
|
export { NgxsStoragePlugin } from './storage.plugin';
|
|
3
|
-
export * from './symbols';
|
|
4
4
|
export * from './engines';
|
|
5
|
+
export { StorageOption, NgxsStoragePluginOptions, STORAGE_ENGINE, StorageEngine } from '@ngxs/storage-plugin/internals';
|
package/src/storage.module.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ModuleWithProviders,
|
|
2
|
-
import { NgxsStoragePluginOptions } from '
|
|
1
|
+
import { ModuleWithProviders, EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { NgxsStoragePluginOptions } from '@ngxs/storage-plugin/internals';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare const USER_OPTIONS: InjectionToken<unknown>;
|
|
5
4
|
export declare class NgxsStoragePluginModule {
|
|
6
|
-
static forRoot(options
|
|
5
|
+
static forRoot(options: NgxsStoragePluginOptions): ModuleWithProviders<NgxsStoragePluginModule>;
|
|
7
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsStoragePluginModule, never>;
|
|
8
7
|
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsStoragePluginModule, never, never, never>;
|
|
9
8
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxsStoragePluginModule>;
|
|
10
9
|
}
|
|
10
|
+
export declare function withNgxsStoragePlugin(options: NgxsStoragePluginOptions): EnvironmentProviders;
|
package/src/storage.plugin.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store';
|
|
2
|
-
import {
|
|
1
|
+
import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store/plugins';
|
|
2
|
+
import { NgxsStoragePluginOptions } from '@ngxs/storage-plugin/internals';
|
|
3
|
+
import { ɵNgxsStoragePluginKeysManager } from './keys-manager';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class NgxsStoragePlugin implements NgxsPlugin {
|
|
6
|
+
private _keysManager;
|
|
5
7
|
private _options;
|
|
6
8
|
private _platformId;
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
constructor(_options: FinalNgxsStoragePluginOptions, _platformId: string);
|
|
9
|
+
private _allStatesPersisted;
|
|
10
|
+
constructor(_keysManager: ɵNgxsStoragePluginKeysManager, _options: NgxsStoragePluginOptions, _platformId: string);
|
|
10
11
|
handle(state: any, event: any, next: NgxsNextPluginFn): any;
|
|
12
|
+
private _hydrateSelectivelyOnUpdate;
|
|
11
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsStoragePlugin, never>;
|
|
12
14
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgxsStoragePlugin>;
|
|
13
15
|
}
|