@ngxs/storage-plugin
Advanced tools
Comparing version 18.1.2 to 18.1.3-dev.master-7e1c703
@@ -1,4 +0,48 @@ | ||
/** | ||
* The public api for consumers of @ngxs/storage-plugin | ||
*/ | ||
export * from './src/public_api'; | ||
import * as i0 from '@angular/core'; | ||
import { ModuleWithProviders, EnvironmentProviders, InjectionToken } from '@angular/core'; | ||
import { NgxsStoragePluginOptions, StorageKey, StorageEngine } from '@ngxs/storage-plugin/internals'; | ||
export { NgxsStoragePluginOptions, STORAGE_ENGINE, StorageEngine, StorageOption } from '@ngxs/storage-plugin/internals'; | ||
import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store/plugins'; | ||
declare class NgxsStoragePluginModule { | ||
static forRoot(options: NgxsStoragePluginOptions): ModuleWithProviders<NgxsStoragePluginModule>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsStoragePluginModule, never>; | ||
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsStoragePluginModule, never, never, never>; | ||
static ɵinj: i0.ɵɵInjectorDeclaration<NgxsStoragePluginModule>; | ||
} | ||
declare function withNgxsStoragePlugin(options: NgxsStoragePluginOptions): EnvironmentProviders; | ||
declare function withStorageFeature(storageKeys: StorageKey[]): EnvironmentProviders; | ||
interface KeyWithEngine { | ||
key: string; | ||
engine: StorageEngine; | ||
} | ||
declare class ɵNgxsStoragePluginKeysManager { | ||
/** Store keys separately in a set so we're able to check if the key already exists. */ | ||
private readonly _keys; | ||
private readonly _injector; | ||
private readonly _keysWithEngines; | ||
constructor(); | ||
getKeysWithEngines(): KeyWithEngine[]; | ||
addKeys(storageKeys: StorageKey[]): void; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgxsStoragePluginKeysManager, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsStoragePluginKeysManager>; | ||
} | ||
declare class NgxsStoragePlugin implements NgxsPlugin { | ||
private _keysManager; | ||
private _options; | ||
private _platformId; | ||
private _allStatesPersisted; | ||
constructor(_keysManager: ɵNgxsStoragePluginKeysManager, _options: NgxsStoragePluginOptions, _platformId: string); | ||
handle(state: any, event: any, next: NgxsNextPluginFn): any; | ||
private _hydrateSelectivelyOnUpdate; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsStoragePlugin, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<NgxsStoragePlugin>; | ||
} | ||
declare const LOCAL_STORAGE_ENGINE: InjectionToken<StorageEngine | null>; | ||
declare const SESSION_STORAGE_ENGINE: InjectionToken<StorageEngine | null>; | ||
export { LOCAL_STORAGE_ENGINE, NgxsStoragePlugin, NgxsStoragePluginModule, SESSION_STORAGE_ENGINE, withNgxsStoragePlugin, withStorageFeature }; |
@@ -1,2 +0,95 @@ | ||
export * from './symbols'; | ||
export * from './storage-key'; | ||
import { Type, InjectionToken } from '@angular/core'; | ||
import { StateToken } from '@ngxs/store'; | ||
import { ɵStateClass as _StateClass } from '@ngxs/store/internals'; | ||
/** This enables the user to provide a storage engine per individual key. */ | ||
interface KeyWithExplicitEngine { | ||
key: string | _StateClass | StateToken<any>; | ||
engine: Type<StorageEngine> | InjectionToken<StorageEngine>; | ||
} | ||
/** Determines whether the provided key has the following structure. */ | ||
declare function ɵisKeyWithExplicitEngine(key: any): key is KeyWithExplicitEngine; | ||
/** | ||
* This tuples all of the possible types allowed in the `key` property. | ||
* This is not exposed publicly and used internally only. | ||
*/ | ||
type StorageKey = string | _StateClass | StateToken<any> | KeyWithExplicitEngine; | ||
declare function ɵextractStringKey(storageKey: StorageKey): string; | ||
/** | ||
* The following key is used to store the entire serialized | ||
* state when no specific state is provided. | ||
*/ | ||
declare const ɵDEFAULT_STATE_KEY = "@@STATE"; | ||
declare const enum StorageOption { | ||
LocalStorage = 0, | ||
SessionStorage = 1 | ||
} | ||
interface NgxsStoragePluginOptions { | ||
/** | ||
* Keys for the state slice to store in the storage engine. | ||
*/ | ||
keys: '*' | StorageKey[]; | ||
/** | ||
* The namespace is used to prefix the key for the state slice. This is | ||
* necessary when running micro frontend applications which use storage plugin. | ||
* The namespace will eliminate the conflict between keys that might overlap. | ||
*/ | ||
namespace?: string; | ||
/** | ||
* Storage engine to use. Deaults to localStorage but can provide | ||
* | ||
* sessionStorage or custom implementation of the StorageEngine interface | ||
*/ | ||
storage?: StorageOption; | ||
/** | ||
* Migration strategies. | ||
*/ | ||
migrations?: { | ||
/** | ||
* Version to key off. | ||
*/ | ||
version: number | string; | ||
/** | ||
* Method to migrate the previous state. | ||
*/ | ||
migrate: (state: any) => any; | ||
/** | ||
* Key to migrate. | ||
*/ | ||
key?: string; | ||
/** | ||
* Key for the version. Defaults to 'version'. | ||
*/ | ||
versionKey?: string; | ||
}[]; | ||
/** | ||
* Serailizer for the object before its pushed into the engine. | ||
*/ | ||
serialize?(obj: any): string; | ||
/** | ||
* Deserializer for the object before its pulled out of the engine. | ||
*/ | ||
deserialize?(obj: any): any; | ||
/** | ||
* Method to alter object before serialization. | ||
*/ | ||
beforeSerialize?(obj: any, key: string): any; | ||
/** | ||
* Method to alter object after deserialization. | ||
*/ | ||
afterDeserialize?(obj: any, key: string): any; | ||
} | ||
interface ɵNgxsTransformedStoragePluginOptions extends NgxsStoragePluginOptions { | ||
keys: StorageKey[]; | ||
} | ||
declare const ɵUSER_OPTIONS: InjectionToken<NgxsStoragePluginOptions>; | ||
declare const ɵALL_STATES_PERSISTED: InjectionToken<boolean>; | ||
declare const ɵNGXS_STORAGE_PLUGIN_OPTIONS: InjectionToken<ɵNgxsTransformedStoragePluginOptions>; | ||
declare const STORAGE_ENGINE: InjectionToken<StorageEngine>; | ||
interface StorageEngine { | ||
getItem(key: string): any; | ||
setItem(key: string, value: any): void; | ||
} | ||
export { type KeyWithExplicitEngine, type NgxsStoragePluginOptions, STORAGE_ENGINE, type StorageEngine, type StorageKey, StorageOption, ɵALL_STATES_PERSISTED, ɵDEFAULT_STATE_KEY, ɵNGXS_STORAGE_PLUGIN_OPTIONS, type ɵNgxsTransformedStoragePluginOptions, ɵUSER_OPTIONS, ɵextractStringKey, ɵisKeyWithExplicitEngine }; |
{ | ||
"name": "@ngxs/storage-plugin", | ||
"description": "extendable storage plugin for @ngxs/store", | ||
"version": "18.1.2", | ||
"version": "18.1.3-dev.master-7e1c703", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"@ngxs/store": "^18.1.2 || ^18.1.2-dev", | ||
"@angular/core": ">=16.0.0 <19.0.0", | ||
"@ngxs/store": "^18.1.3 || ^18.1.3-dev", | ||
"rxjs": ">=6.5.5", | ||
@@ -79,2 +79,2 @@ "ts-morph": "21.0.1" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121703
22
854
1